Is it possible to save a DLL in memory after calling processes?

I have a DLL that takes 5 to 10 seconds to load, which means that I have to wait so long every time I compile and run an executable file that uses it. Is there a way to save a DLL loaded into memory so that it can be obtained immediately every time the corresponding executable is compiled? I compile the program on QT MinGW, if relevant.

EDIT: Not lucky yet. Loading a DLL into another program does not seem to have any effect (the original program still loads the DLL and takes the same amount of time to do this). I would suggest that I need to load the DLL and its functions in different ways if they were loaded into another program, but I do not know how to do it. I am currently using LoadLibrary and GetProcAddress.

+5
source share
4 answers

The easiest solution (subject to MSVC ++) is to make a delay DLL. Of course, the trade-off is that initialization still needs to happen, but that will no longer delay other parts of your program. For instance. you can do it in the background thread.

+1
source

MinGW, , DLL. :

, , .

, , DLL. , EXE DLL . (), EXE/DLL. , , EXE/DLL. DLL, . , . ( DLL), 8K . DLL, . , . , .

DLL , (, EXE) , DLL. DLL, DLL.

, - DLL ( --image-base --enable-auto-image-base linker), DLL ( ). , DLL . DLL, ( ), DLL. DLL , 1) DLL . 2) ( , DLL). 3) DLL ( ).

Process Explorer, , , DLL . "DLL" "View" / "Lower Pain View" " DLL" " " "". , DLL . , , , , , DLL:

enter image description here

, DLL Lenovo TPOSDSVC.dll, HKVOLKEY.dll TPLHMM.dll 0x10000000, DLL (TPOSDSVC.dll ), .

. . (--image-base --enable-auto-image-base, , , ). dumpbin.exe ( Visual Studio ) PE.

, DLL , bind.exe -u EXE DLL DLL. . IMAGE_DIRECTORY_ENTRY_IMPORT IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT DLL EXE (. ). bind.exe API BindImageEx. Windows BindImage BindImage, EXE DLL.

(. ), DLL EXE.

, MinGW, . Visual Studio : Delayimp.lib /DELAYLOAD (. ), , DLL , . Dependency Walker, , DLL- Microsoft . , .

+2

, DLL. , . , . , , . , , , - winlogin.exe. Windows API , .

+1

, Windows DLL , :

#include <conio.h>
#include <windows.h>

int main()
    {
    HMODULE handle=LoadLibrary("yourdll.dll");
//  Make shure Windows resolves the DLL
    FARPROC dummy=GetProcAddress(handle,"functionInDll");
//  The process will now just wait for keyboard input.
    getch();
    CloseHandle(handle);
    return 0;
    }
+1

All Articles