|
|
DLL call problems...
#300133
11/30/09 05:40
11/30/09 05:40
|
Joined: Mar 2009
Posts: 5
peonytele
OP
Newbie
|
OP
Newbie
Joined: Mar 2009
Posts: 5
|
hi everyone: i have some problems when i call a DLL in A7: first, there is another DLL written by VS2003,just simple example,code like this: testDLL.cpp: #include <windows.h> #include <stdio.h> #include <iostream> #include <tchar.h> #include "testDLL.h" int WINAPI testMax(int a, int b) { return a; }
testDLL.def: LIBRARY qq EXPORT testMax @ 1
then,i wrote a main DLL which is for the Engine to call.code like this:
MyDLL.cpp: #define DLL_USE #include "stdafx.h" #include <iostream> #include <iomanip> #include <tchar.h> #include "adll.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { engine_bind(); return TRUE; } DLLFUNC var testDll() { typedef int( * test)(int, int); HINSTANCE hDLL; test testMax; int result; hDLL = LoadLibrary("qq.dll"); if(hDLL != NULL) { testMax = (test)GetProcAddress(hDLL, "testMax"); if(testMax != NULL) { result = testMax(1, 0); FreeLibrary(hDLL); return _VAR(result); } else return _VAR(3); } else { return _VAR(4); } }
both DLL was complied with no errors,and i got 2 DLL files: qq.dll,MyDll.dll,i just put them in the same path. when i call the function in Lite-C:
var deadpoint = 0; deadpoint = testDll(); the deadpoint`s value is always 3,that means the GetProcAddress function has a NULL return value? that is the problem i want to solve...hope someone could help,thanks!!
|
|
|
|