Runtime erro in the Callback where got the return for called another DLL dynamically
I try to be more clear this time. I have a main program for test that call Sinacor.DLL that for it turn call PasswordManager.dll a 3er part dll without code (its a IDM system);
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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
I now is a parameter convention error that why I complied both (main and Sinacor.dll) as a C programs with C conventions. The stack show all modules as a C module with C conventions Should works but isn´t . Please advice.
both programs were complited with _cstl (like CALLBACK).
精彩评论