这次我试着更清楚。 我有一个主要的测试程序,调用Sinacor.DLL为它调用PasswordManager.dll一个3er部分dll没有代码(它是一个IDM系统);
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sinacor.DLL
...code ....
LPSTR *GetSenha (int FAR nicas)
.... code.....
char * Mypwd = NULL; // for return porpouse
Mypwd = call dynamically PasswordManager.dll // works fine
return Mypwd; } // return the encrypted password, in test case return "sinacor01"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sinacor..h
extern "C" { LPSTR FAR *GetSenha(int); }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
the Sinacor.dll is also loaded dynamically too in the main program for testing:
the main code:
.....some code ..............
typedef LPSTR (CALLBACK *ULPRET)(int);
LPSTR Mypwd = " ";
hLib = LoadLibrary ( "C:\\Ricardo\\Sinacor\\Sinacor.dll");
lpfnDLLProc = (ULPRET) GetProcAddress (hLib,"GetSenha");
Mypwd = (*lpfnDLLProc)(0); //Got runtime error in this statement
我现在是一个参数约定错误,为什么我将(main和Sinacor.dll)作为具有C约定的C程序进行了编译。堆栈将所有模块显示为具有C约定的C模块应该有效但不是。 请指教。
这两个程序都与_cstl(如CALLBACK)完成。