1 #include <iostream> 2 #include <windows.h> 3 4 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 6 typedef int (__stdcall *ptrSub)(int); 7 8 HMODULE hm = LoadLibrary("111.dll"); 9 10 int main() { 11 if(hm){ 12 ptrSub ceshi=(ptrSub)GetProcAddress(hm,"kpf"); 13 if(ceshi) 14 printf("%d\n",ceshi(9)); 15 }else{ 16 printf("dll加载失败\n"); 17 } 18 FreeLibrary(hm); 19 return 0; 20 }
代码也没问题啊