GetProcAddress后无法调用函数
MSOKD 2011-05-29 11:28:15 #include <stdio.h>
#include <windows.h>
typedef int (CALLBACK * LPFNDLLFUNC1)(int,int);
LPFNDLLFUNC1 cal;
int re;
int main(){
HMODULE hmod=LoadLibrary(TEXT("dll1.dll"));
printf("%d\n",GetLastError());
cal = (LPFNDLLFUNC1)GetProcAddress(hmod,"add");
printf("%d\n",GetLastError());
printf("%d\n",cal);
printf("%d",GetProcAddress(hmod,"add"));
re=cal(1,2);// add函数 2个GetLastError());都返回0 都能正解得到地址,但是
system("pause");
exit(0);
}
add函数 为
int add (int a,int b){
return a+b
}
其中 2个GetLastError());都返回0 都能正确得到地址,但是就是不能用cal来调用.