I usually prefer to see (and manipulate?) what the value of the defines are, without needing to change APIENTRY (which, frankly, will FUCK UP windows.h if edited) in case you want an actual change.
The biggest change in this context is the 'extern "C" ', which will "convert" (when possible) your functions from C++ to C naming and style.
If you're natively using C, you don't need it, but if you want to overload functions, you cannot use extern "C", because of this:
1 2
|
FNCINFO void CALLTYPE myoverload(void*) {}
FNCINFO void CALLTYPE myoverload(int) {}
|
What happens when you use C++ naming? (Without extern "C")
Two functions will be generated.
To avoid confusions, every function name will contain details about its parameters and return value.
As an example, the first overload may become @4as@myoverload and other gibberishy things you may not understand on the fly.
The second one will have a different gibberishing.
What happens with C naming? (with extern "C")
Two functions cannot be generated: C does not support overloading.
You must separate them in two different functions:
myoverload1 and myoverload2.
Their actual name will be kept for stdcall, and if cdecl their name will have an underscore (_) before their name.
Example:
FNCINFO int __stdcall myfnc() {}
Name -> myfnc
FNCINFO int __cdecl myfnc() {}
Name -> _myfnc
You must take them into account yourself when using GetProcAddress.
If you use dllimport, the compiler/linker will handle it for you.
To understand which function signature is used by a C++-decorated-name function, use UnDecorateSymbolName from DbgHelp.h :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681400(v=vs.85).aspx
This will also give you custom classes' names (as they will be included in the full name).
It's all simpler than it looks like, big posts doesn't mean hard things.
I just want to be clean to explain these things.
These informations mostly apply to MSVC.