关于dll的简单问题
为什么存在内存泄漏?代码如下:
void __fastcall Tjhoper_Frm::addinf()
{
HINSTANCE Dll=LoadLibrary("jh6.dll");
if(Dll)
{
LoadJHFunc=(JHFunc *)GetProcAddress(Dll,"_sbbg_addinf");
if(LoadJHFunc)
{
if(LoadJHFunc(nfEdt->Text,unitid,xmbmEdt->Text,xmmcEdt->Text,gznrEdt->Text,lrjhyyEdt->Text,zysbclEdt->Text,fyEdt->Text.ToDouble(),1)!=true)
{
FreeLibrary(Dll);
return;
}
init();
}
else
ShowMessage("数据库暂时无法连接");
FreeLibrary(Dll);
if(Dll!=NULL)
{
ShowMessage("I still live in this computer!");
}
}
else
{
ShowMessage("找不到指定模块");
}
}
//------------------------------------------------------------------------------------------------------
总是出现下面的"I still live in this computer"提示。如果我使用if(FreeLibrary(Dll)!=true)
{
GetLastError();
}
的话,感觉dll已经被释放掉了,但是老出现内存泄漏的错误。
我在其它的地方也使用了几乎同样的函数就没事。烦请各位帮我看一看,不胜感激!(我是使用的别人的机器上的网,所以不能在线,但是请大家一定帮我看看亚:))