Home > Back-end >  Released qt program how to separate dependent DLL under different directories
Released qt program how to separate dependent DLL under different directories

Time:12-11

QT program, exe executable and DLL files are in the same directory, I now want to put those DLLS, into a folder, the folder and exe in the same directory, so how should do?

Hope everyone passing by the great god gives directions

CodePudding user response:

1 lazy loading DLL, exe runs, use SetDllDirectory first,
First 2 USES other exe start, set up the PATH

CodePudding user response:

In the main call SetDllDirectory
 # include "mainwindow. H" 
#include
H # include "Windows."
Int main (int arg c, char * argv [])
{
QString s="./DB ";
LPCWSTR path=s.t oStdWString (.) c_str ();
SetDllDirectory (path);

QApplication a (arg c, argv);
The MainWindow w;
Baron how ();

Return a.e xec ();
}

1 lazy loading DLL, exe runs, use SetDllDirectory first,
2 use other exe start, first set the PATH
This is two kinds of method or a method of two steps?
And how lazy loading DLL?

CodePudding user response:

reference 1st floor akirya response:
1 lazy loading DLL, exe runs, use SetDllDirectory first,
2 use other exe start, first set the PATH

Can say in detail?

CodePudding user response:

Assuming that the DLL in the folder under test, add the words to the main. CPP,
 QCoreApplication: : addLibraryPath ("./test "); 

CodePudding user response:

refer to the second floor u012830675 response:
call in main SetDllDirectory
 # include "mainwindow. H" 
#include
H # include "Windows."
Int main (int arg c, char * argv [])
{
QString s="./DB ";
LPCWSTR path=s.t oStdWString (.) c_str ();
SetDllDirectory (path);

QApplication a (arg c, argv);
The MainWindow w;
Baron how ();

Return a.e xec ();
}

1 lazy loading DLL, exe runs, use SetDllDirectory first,
2 use other exe start, first set the PATH
This is two kinds of method or a method of two steps?
And how lazy loading DLL?


Two methods

CodePudding user response:

reference 4 floor qq423399099 response:
assumes that the DLL in the folder under test, add the words to the main, CPP,
 QCoreApplication: : addLibraryPath ("./test "); 

I have two questions:
1, my exe calls DLL1, DLL1 call DLL2 again, and now DLL1 DLL2 are in the test folder, QCoreApplication: : addLibraryPath ("./test "); Is that ok?
2, I DLL1 and many other types of files, I under the test file,
According to you provide method, when the debug exception to find DLL2,

CodePudding user response:

I use the QCoreApplication: : addLibraryPath (absolute path);
Exe direct call DVPCSHARP_CLR. DLL, DVPCSHARP_CLR. DLL can call other documents, such as DVPCSHARP_CLR. DLL
Abnormal running:

CodePudding user response:

AddLibraryPath () is for plug-in directory

CodePudding user response:

Dig a grave, the building Lord problem solved

CodePudding user response:

To solve, bosses
  • Related