using _hand = handle * (*)();
bool dllClass::loadModel(QString fliePath)
{
QDir dir;
QStringList filter{ "*.dll" };
if (fliePath == nullptr)
{
//QDir dir(QDir::currentPath());
dir.setPath(QDir::currentPath());
}
else
{
dir.setPath(fliePath);
}// end of if
dir.setNameFilters(filter);
auto fileInfo = dir.entryInfoList(filter); //过滤dll文件
for (auto &name : fileInfo)
{
auto hDll = LoadLibraryA(((name.fileName().toStdString().c_str())));
if (NULL == hDll)
{
continue;
}//end of if
m_hDll.push_back(hDll);
auto hand_ = (_hand)GetProcAddress(hDll, "getInstance");
if (NULL == hand_)
{
continue;
}//end of if
auto hadle__ = hand_(); //这里取出来的是一个对象
m_handle.push_back(hadle__); //遍历的类放入有List容器中
}//end of for
return true;
}