I currently have a C++ sample calling for a C++ dll function this way :
typedef BOOL(__stdcall *f_funci)(const char*, char*);
HINSTANCE hGetProcIDDLL = LoadLibrary(L"myDLL.dll");
f_funci DoSmth= (f_funci)GetProcAddress(hGetProcIDDLL, "function");
std::string test = "The cake is a lie, it's actually a Brownie...";
char *out = new char[124];
DoSmth(&test[0], out);
and the dll function prototype :
BOOL function(const char *in, char *out){}
The problem is, when i call this dll function, i got a totally random result at in[x] (whatever x value) (using visual studio debugger).
However, if i simply paste this function inside my .cpp, in[x] is always the result i would expect to have.
What i verified :
- dll function's calling convention is stdcall, as expected.
- both the sample and the dll are in the following context - Debug - x64 -
What i think it could possibly come from but don't know enough to ensure a Yes/No answer:
- memory management difference between a "simple call" and a GetProcAddress ?
- Debugger issue (would be weird considering the out value is also false in dll call case)
- Other ?
Thanks for help & time !
PS : Please consider asking for details if something is unclear !
Aucun commentaire:
Enregistrer un commentaire