1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| NS_IMETHODIMP CSpecialThing::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval)
{
PRInt32 test;
typedef char* (_stdcall *ProcDllPtr)(char* monString);
char* reponseDLL;
HMODULE hinstDLL=LoadLibraryA((LPCSTR)"C:\\DLMDLL.dll");
if (hinstDLL)
{
ProcDllPtr ProcExportDll = (ProcDllPtr) GetProcAddress(hinstDLL,
"Ajouter_article");
reponseDLL=ProcExportDll((char*)("affiche moi"));
}
else
{
//traitement erreur
}
FreeLibrary((HINSTANCE)hinstDLL);
PRInt32 * testa = reinterpret_cast<PRInt32 *>(reponseDLL);
test=*testa;
*_retval = test;
return NS_OK;
} |