problems using a C dll.-Collection of common programming errors
I’m creating a dll using MingW, the functions are exported as
extern HsInt32 __attribute__((__stdcall__)) genNumberSec(HsInt64 a1);
and after compilation the dll’s Export table contains among other
8972 230B 00002DF0 genNumberSec@8
so far so good. Creating a test app and compiling using the gcc in MingW also worksfunction imported as
extern int __attribute__((__stdcall__)) genNumberSec (long long int var1);
and this works fine,however the problems come when I try and use VC++ to access this dll.I first create a DEF file which containsLIBRARY WinDllEXPORTS
genNumberSec@8
and then call lib to create the .LIB file.I add this to my VC++ project and use as an import statement
extern "C" __declspec(dllimport) int __stdcall genNumberSec (long long int var1);
It’s able to compile and link the program, but at runtime it’s not able to find the entry point for genNumberSec.
the precise error is “The procedure entry point genNumberSec@8 could not be located in the dynamic link library WinDll.dll”
but running dumpbin /EXPORTS WinDll shows again that it’s in the table.
Anyone have any suggestions?