typedef int (*myfun)();
QString path = QCoreApplication::applicationDirPath() + "/windowContrl.dll";
QLibrary hdll(path);
int result = 0;
if(hdll.load())
{
myfun fun1 = (myfun)hdll.resolve("vCloseFrontWindow");
{
if ( fun1 )
{
//result = fun1();
//return result;
qDebug()<<"loaded";
}
else
{
//return -1;
}
}
}
else
{
// return -3;
}
hdll.unload();很简单的加载动态库,之后,关闭程序会有内存泄露