Reputation: 24766
I'm pretty sure I don't have clear understanding about C++ Name Mangling. But as I know there is no stranded for C++ Name Mangling. So my question is
Think I compiled DLL or LIB using one compiler. They try to use above DLL or LIB in a program compiles using different compiler.
So how second compiler identify the functions, class, data types etc.. inside that LIB or DLL? (I guess above two compiler having different Name Mangling)
from wiki
There isn't a standard scheme by which even trivial C++ identifiers are mangled, and consequently different compiler vendors (or even different versions of the same compiler, or the same compiler on different platforms) mangle public symbols in radically different (and thus totally incompatible) ways.
Upvotes: 0
Views: 197
Reputation: 490663
Generally speaking, you have two choices:
stdcall
.Note that name mangling is generally the least of your concerns with something like this. Getting the names to match would actually be pretty easy in most cases. The real problem is that different compilers produce code using different calling conventions. If those don't match (precisely), the best you can hope for is for the resulting program to crash quickly and cleanly. Differences in name mangling simply catch the problem early, and keep differences in calling convention from destroying your data.
Upvotes: 2