Is it possible to keep DLL in memory after calling process exits?

c++, dll, qt

Solution

The easiest solution is (assuming MSVC++) to make the DLL delay-loaded. The trade-off of course is that the initializaton still has to happen, but this will no longer delay other parts of your program. E.g. you can do it on a background thread.

Problem

I have a DLL that takes 5 to 10 seconds to load, which means that I have to wait that long every time I compile and run the executable that uses it. Is there a way to keep the DLL loaded in memory so that it can be immediately accessed every time I compile the corresponding executable? I'm compiling the program on QT MinGW, if that's relevant. EDIT: No luck so far. Loading the DLL on another program seems to have no effect (the original program still loads the DLL, and takes just as long to do so). I would guess I need to load the DLL and its functions differently if they've been loaded into another program, but I don't know how to do this. Right now I'm using LoadLibrary and GetProcAddress.

Original source

Related problems