Typeid result for different dlls

I have two dll libraries that declare a template type, call A. If the declaration of A is quite complicated, it happens that the result of typeid (A) .name () is different when calling functions in two different DLL files.

Example:

Dll1:

struct MyType: public A< TEMPLATE_LIST_OF_A >{}

void f(){
std::string name1 = typeid(A).name();
}

DLL2:

struct MyType: public A< TEMPLATE_LIST_OF_A >{}
    void f(){
    std::string name2 = typeid(A).name();
    }

for example, name1 could be something like: "??? MyType ??? etc." while name2 may be "???? TEMPLATE_LIST_OF_A etc.".

Which actually makes sense to me, but is there a way, provided the names used are the samem, to ensure that name1 == name2?

thanks rob

+3
source share
3 answers

, typeid().name() DLL , . , a) , b) , c) .

, , . , , .

98 5.2.8 18.5.1

+3

, (-).

typeid(). name() .

0

If two DLLs are compiled with exactly the same OS, compiler and compiler options, it seems likely that the types would be the same.

0
source

Source: https://habr.com/ru/post/1751750/


All Articles