Tried is not successful, because don't know whether I a. d. LL load inside B.D LL not success.
Here are others say there are solutions, but I tried or not:
Methods a LoadLibraryEx
If the DLL is not in the same directory, the caller can use LoadLibrary (L "of" the absolute path to the DLL) is loaded, but if call DLL internal call another DLL and call at this time still fail, the solution is to use LoadLibraryEx:
Eg: LoadLibraryEx (" DLL absolute path ", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
By specifying LOAD_WITH_ALTERED_SEARCH_PATH, let the system DLL search order from the beginning of the DLL directory,
Way 2 using SetCurrentDir
Across a directory called DLL, you should
1 with GetCurrentDir save the current working directory
2 use SetCurrentDir set the current working directory, as of your DLL's path, you need to use absolute paths
3 use LoadLibrary your DLL
4 use SetCurrentDir restored to the original work path
Eg:
TCHAR chCurDir [MAX_PATH]={0};
GetCurrentDirectory (MAX_PATH chCurDir);
SetCurrentDirectory (_T (" c: \ \ test \ \ "));
M_hDLL=LoadLibrary (_T (" demo. DLL "));
SetCurrentDirectory (chCurDir);
CodePudding user response:
Can ah,M_hDLL=LoadLibrary (_T (" c: \ \ test \ \ demo DLL "));
So try
CodePudding user response:
If you specify an absolute path, no matter where the call should be no problem,If your B.d ll itself to other specific DLL have rely on,
CodePudding user response:
This is can certainly,You can use the global look at loading the, basically is to see you compile and run the situation,
See if load dynamic library itself has a problem or dynamic loading when you have any question