(求助)DLL导出函数问题
MyDLL.dll 我自己写的一个DLL文件 里面有
__declspec(dllexport) DWORD ExportExample(LPSTR szMSG,DWORD dwCode);
DWORD ExportExample(LPTSTR szMSG,DWORD dwCode)
{
LPTSTR lpShowOut = (LPTSTR)HeapAlloc(GetProcessHeap(),NULL,lstrlen(szMSG)+100);
wsprintf(lpShowOut,TEXT("%s,%d"),szMSG,dwCode);
MessageBox(NULL,lpShowOut,TEXT("ExportExample"),MB_OK);
HeapFree(GetProcessHeap(),NULL,lpShowOut);
return 0;
}
然后我在我另外一个工程中 成功导入了DLL(我写了导入时弹出对话框)
LoadLibrary(L"D:\\MyDLL.dll");
pfnShow pfn = (pfnShow) GetProcAddress(GetModuleHandle(L"MyDLL"),"ExportExample");
if (pfn == NULL)
{
printf("GetProcAddress Error : %d\n",GetLastError());
return -1;
}
pfn(TEXT("message"),12);
return 0;
但是每次pfn的值都为NULL 请问这个是什么原因。。。3Q~~~