function from dll
-
Hi, My problem : I want to call a function from a DLL and isn't working the function is : // this code is from dll ...... DWORD test(DWORD x) { if (x==1) MessageBox(NULL, "work DLL", "working", MB_OK); return 0; } // ............ in my program I wrote : typedef DWORD (*LPtest)(DWORD); LPtest test = NULL; hDll = LoadLibrary("test.dll"); test = (LPtest)GetProcAddress(hDll,"test"); DWORD a = GetLastError(); hDll is not NULL .... and .... a is 127 ... "The specified procedure could not be found." and if I try something like test(1); the program gets an ACCESS VIOLATION ! please help !!!
-
Hi, My problem : I want to call a function from a DLL and isn't working the function is : // this code is from dll ...... DWORD test(DWORD x) { if (x==1) MessageBox(NULL, "work DLL", "working", MB_OK); return 0; } // ............ in my program I wrote : typedef DWORD (*LPtest)(DWORD); LPtest test = NULL; hDll = LoadLibrary("test.dll"); test = (LPtest)GetProcAddress(hDll,"test"); DWORD a = GetLastError(); hDll is not NULL .... and .... a is 127 ... "The specified procedure could not be found." and if I try something like test(1); the program gets an ACCESS VIOLATION ! please help !!!
-
Hi, My problem : I want to call a function from a DLL and isn't working the function is : // this code is from dll ...... DWORD test(DWORD x) { if (x==1) MessageBox(NULL, "work DLL", "working", MB_OK); return 0; } // ............ in my program I wrote : typedef DWORD (*LPtest)(DWORD); LPtest test = NULL; hDll = LoadLibrary("test.dll"); test = (LPtest)GetProcAddress(hDll,"test"); DWORD a = GetLastError(); hDll is not NULL .... and .... a is 127 ... "The specified procedure could not be found." and if I try something like test(1); the program gets an ACCESS VIOLATION ! please help !!!
It sound likes that you does not export the function "DWORD test(DWORD x)", you can get your current exports table via typing "dumpbin /exports test.dll" in console. In normally, VC6 exports your test function in this form: _test@2 For telling the compiler we need to export this function in standard mode, save follow lines in notepad in a .def file and then add it to your dll project: EXPORTS test At the end, change declares line "DWORD test(DWORD x)" to "__declspec(dllexport) DWORD test(DWORD x)" for avoid the warning(dllexport assumed). Good Luck.
-
It sound likes that you does not export the function "DWORD test(DWORD x)", you can get your current exports table via typing "dumpbin /exports test.dll" in console. In normally, VC6 exports your test function in this form: _test@2 For telling the compiler we need to export this function in standard mode, save follow lines in notepad in a .def file and then add it to your dll project: EXPORTS test At the end, change declares line "DWORD test(DWORD x)" to "__declspec(dllexport) DWORD test(DWORD x)" for avoid the warning(dllexport assumed). Good Luck.