Search code examples
c++visual-studiolinkername-mangling

Wrong function name mangling


I have a static library exporting the function

time_t SomeClass::getTime();

After compilation its name is mangled as

?getTime@SomeClass@@QAE_JXZ

When I try to use it, VS returns an error

error LNK2001: unresolved external symbol "public: long __thiscall SomeClass::getTime(void)" (?getTime@SomeClass@@QAEJXZ)

And I don't know what is wrong. Why the same function is mangled differently? I've compiled both projects with the same Visual Studio, class has a single header.

Please, help.


Solution

  • The problem was in difference in time_t declarations. Library means it is 64-bit, but application waits for 32-bit value.

    The remaining question is "why there is no good documentation for MSVS name mangling"? I've read a lot, but didn't find what is the underline in parameters list.