Please see:
https://msdn.microsoft.com/en-us/library/Aa271769%28v=VS.60%29.aspx[
^].
It says that using
__declspec(dllimport)
and
__declspec(dllexport)
with the same version of the same compiler produces matching naming on the same function declaration.
If, by some reason, you need to apply arbitrary naming for exported functions or you have to import some functions with arbitrary naming, this problem is solved using DEF files. Please see:
https://msdn.microsoft.com/en-us/library/hyx1zcd3.aspx[
^].
As you can see, you can specify both names: the function name as it is seen in the C++ function declaration, and the alternative name (mangled/decorated or not) as it appears in the DLL. See also:
https://msdn.microsoft.com/en-us/library/28d6s79h.aspx[
^],
https://msdn.microsoft.com/en-us/library/54xsd65y.aspx[
^],
https://msdn.microsoft.com/en-us/library/9h658af8.aspx[
^].
[EDIT]
Sorry, I wanted to mention the use of
GetProcAddress
, but forgot, and forgot that this was what you actually tried to use. Of course, you need to use mangled/decorated name with it. My credit to Solution 2 by Frankie-C.
—SA