在应用程序中调用dll:
         HINSTANCE hinstDLL=NULL;

         hinstDLL=LoadLibrary("CLVariableLinkDll.dll");
if (hinstDLL)
{
Connect Proc;
Proc = (Connect)GetProcAddress(hinstDLL,"MyTest");
int nValue;
nValue = 5;
int nTemp = Proc(nValue);
FreeLibrary(hinstDLL);
}
else
{
AfxMessageBox("Not found dll !");
}
在dll中用DAO访问数据库:
         strDBName = "d:\\db.mdb";
         m_pDB=new CDaoDatabase;
try
{
m_pDB->Open(strDBName);
}
catch(CDaoException* e)
{
AfxMessageBox(e->m_pErrorInfo->m_strDescription,MB_ICONEXCLAMATION);
delete m_pDB;
e->Delete();
return FALSE;
}
         .........
         if(m_pDB->IsOpen())
{
m_pDB->Close();
}关闭数据库时一切正常,可是在运行程序中,FreeLibrary(hinstDLL);释放时就出现错误(debug assertion Failed!),请高手指点一下,多谢了!