13,870
社区成员




//主应用程序
HINSTANCE ins;
ins = LoadLibrary("./dll/dllTalk.dll");
try
{
if(ins == NULL)
throw MyException("Can't Load Library!");
FARPROC lpFarProc; //回调函数未成功
lpFarProc = GetProcAddress(ins,"call");
if(lpFarProc == NULL)
{
FreeLibrary(ins);
throw MyException("Can't Get dd Address!");
}
typedef int (*pfv)();
typedef void (* pt)(pfv);
pt aFunc = (pt)lpFarProc;
aFunc(test1); //出错在这里
if(!FreeLibrary(ins))
{
throw MyException("Can't Free!");
}
}
catch (MyException &myException)
{
ShowMessage(myException.test);
}
………………
int test1()
{
return 0;
}
//dll程序
extern "C" __declspec(dllexport) void __stdcall call(int (*CallBack)())
{
CallBack();
}