I have a bit of code which has the following line
#pragma comment(linker, "/include:_test@12")
The project which uses this code works fine when I compile the code using C++ Visual Studio 2010 with configuration type 32bit (I am also on a 32 bit windows machine).
I get a link error when I change the machine to 64bit and use x64 configuration which compiling with C++ Visual Studio 2010.
Is C++ name mangling different for 32bit vs 64bit? If so, where can I find the 64bit C++ name mangling conventions?
Yes the name mangling is different between 32 and 64 bit. A reasonable article covering the exact formats can be found here. You can tell the major differences pretty quickly, however, buy simply compiling to both targets and examining the resulting map files. From my experience they're almost identical (64bit adds a small datum, potentially changes others).
Simple sample:
void foo();
For non-mangled std call, the length suffix can be substantially different, depending on the parameter stack usage. The default 64-bit settings for VC++ do not prepend underscores nor does it encode length-suffixes. The following was compiled both 32/64bit configs with pure out-of-the-box settings:
Not much point there, is there.
Completing the circuit, unmangled _cdecl, which does this:
If it seems like they went out of their way to make you know what you're pulling-in or exporting-out, evidence suggests you're probably correct.