omegaomega
asked on
GetProcAddress returns zero (not a name mangling problem)
I'm converting an old 32 bit dotNet application for use in a 64 bit environment. The application GUI is VB, and the computational side is comprised of a set of DLLs written in Fortran. At run-time the GUI loads the appropriate DLL using LoadLibrary and then locates the appropriate Fortran routine by calling GetProcAddress with the handle returned by LoadLibrary and the name of the Fortran routine.
This works fine in the original 32 bit environment (Windows XP), but when running as a 64 bit application (Windows 10) GetProcAddress fails to find the named routine, returning zero, following which GetLastError reports #126. I am aware that a very common cause of this problem is failure to be aware of C++ name mangling, and have very carefully checked the routine names in the DLL using both Dependency Walker and Dumpbin and these do match the name being provided to GetProcAddress.
Though I'm not sure that it's relevant, there is one thing that distinguishes the Dumpbin output of the 64 bit DLL from that of the 32 bit DLL. In the former case the names are shown in the form NAME = NAME. In the Dumpbin listing of the 32 bit DLL the "= NAME" is missing. I have attached copies of these two Dumpbin listings for reference.
Any guidance that is offered on how to resolve this problem will be greatly appreciated.
Thanks,
Randy
Dump64.txt
Dump32.txt
This works fine in the original 32 bit environment (Windows XP), but when running as a 64 bit application (Windows 10) GetProcAddress fails to find the named routine, returning zero, following which GetLastError reports #126. I am aware that a very common cause of this problem is failure to be aware of C++ name mangling, and have very carefully checked the routine names in the DLL using both Dependency Walker and Dumpbin and these do match the name being provided to GetProcAddress.
Though I'm not sure that it's relevant, there is one thing that distinguishes the Dumpbin output of the 64 bit DLL from that of the 32 bit DLL. In the former case the names are shown in the form NAME = NAME. In the Dumpbin listing of the 32 bit DLL the "= NAME" is missing. I have attached copies of these two Dumpbin listings for reference.
Any guidance that is offered on how to resolve this problem will be greatly appreciated.
Thanks,
Randy
Dump64.txt
Dump32.txt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The Author found the mistake made by himself.
Sara
Sara
ASKER
Thanks,
Randy