I am trying to link against a dll, which is accompanied by a header file. Since there were no *.lib file available, I made one by manually creating a *.def file (Ref)
Now the problem is, my test program is __cdecl
and the methods in the dll are __stdcall
.
Is there a way to force __stdcall
for specific methods when they are dynamically linked?
Even though its not an option, tried changing the calling convention (/Gd
) to /Gz
, but the name mangling came up saying the linker failed to find the slightly mangled method as shown below.
LNK2019 unresolved external symbol _TSTInitialize@24 referenced in function
The function signature in header file is,
#define TSTPERC_API /*__declspec( dllimport ) __stdcall */
TSTHandle cOpts;
//call native methods
TSTFunctionResult cResult = ::TSTInitialize(
p_strPathToLib.c_str(), p_strConfigStruct.c_str(), p_strLic.c_str(),
p_strRFU1.c_str(), p_strRFU2.c_str(), &cOpts );