C++代码执行过程中如何连接dll文件?

How to connect the dll files in the process of code execution in C++?

有一个用QT(C++)编写的编译程序。在程序文件夹中添加了所有名称为Lib1.dll、Lib2.dll等的dll文件,在程序执行过程中如何获取这些库? IE。最初程序是在没有它们的情况下编译的

例如:

int n = 10;
for(int i=0;i<n;i++)
{
       include("lib"+i+".dll");
}

问题已通过使用 QLibrary 解决

 for(int i=0; i<n;i++)
    {            
       QString* pLoadLib =&sDrivers[i]; //запоминаем адрес переменной
       std::cout<<sDrivers[i].toUtf8().constData()<<"\n";//выводим в консоль
       QLibrary lib(*pLoadLib); //Разименование адреса - текст пути к ДЛЛ
       if (!lib.load())
          {
             std::cout<<"driver not loaded\n";//error
          }
       else
          {   typedef QString (*FuncType) (const QString&);
                    FuncType func = (FuncType)(lib.resolve("FuncName")); //Определяем функцию func как функция OddUpper из dll
                    if (func)
                    {
                       QString test = func("working");
                       qDebug()<<test;
                    }
                    if (!func)
                    {
                        std::cout<<"func not loaded";
                    }
                    lib.unload();
                }
    }