I am trying to port a 32-bit dll (and application) to 64-bit and I have managed to build it without errors. When trying to load it with my 64-bit application I noticed that the
For Win32 build:
If you use __stdcall
, you will get something like this (dumped with dumpbin /exports
):
__declspec(dllexport) int __stdcall
->
ordinal hint RVA name
1 0 00001240 _F1@0 = _F1@0
2 1 0000124D _F2@0 = _F2@0
And you have to use GetProcAddress("_F1@0")
to locate the function pointer.
If you use __cdecl
, you will get something like this:
__declspec(dllexport) int __cdecl
->
ordinal hint RVA name
1 0 00001240 F1 = _F1
2 1 0000124D F2 = _F2
And you can use GetProcAddress("F1")
to locate the function pointer.
BTW, if you add a XXX.def
file to your Visual Studio project. One more link option will be silently added to your linker command line /DEF:"XXX.def"
in the All Options
window. And if you change your .def
file name later for whatever reason, this link option doesn't change accordingly. You need to manually change the def file name in the project properties window.