扩展MFC DLL
李赞红 2005-01-27 10:30:39 我在MFC扩展DLL中写了一个函数:
__declspec(dllexport) BOOL isOdd(int num)
{
if(num % 2 == 0)
return true;
else
return false;
}
在另一个测试程序中这样调用:
typedef BOOL ISODD(int);
ISODD *isOdd;
HINSTANCE hm;
if(hm = ::LoadLibrary("mfcdll3.dll"))
{
isOdd = (ISODD *)::GetProcAddress(hm,"isOdd");
if(isOdd)
{
if(isOdd(8))
MessageBox("是偶数");
else
MessageBox("不是偶数");
}
else
{
MessageBox("有问题");
}
::FreeLibrary(hm);
}
else
{
MessageBox("DLL加载失败");
}
但是有问题,是不是和普通的DLL调用不一样啊?