Reputation: 165
I created a QT app that needs two dlls files at runtime to resolve some function from them,
I have two questions:
1) Can i add that files to QT Resource to make the App loads them directly from resource without extracting to local path ?
2) If the Answer is "no"; How can i add a path to make the App searchs for that dlls in ?
Note: Names of dll files are stored in a ".a" lib that compiled with the App.
EDIT:
My situation is like the next:
let's say I built MingW QT 5.13.1 from the Source statically with "-openssl-runtime".
Now each app we build using that MingW will search for libcrypto-1_1.dll
& libssl-1_1.dll
in the same exe dir BUT the app can run without them only will face TLS initialization failed
when requesting https
urls.
Can i make the App load that dlls from Resource or force the App to search for them in another Path ?.
Upvotes: 0
Views: 888
Reputation: 4867
First it's important to distinguish different ways of loading external libraries. Essentially:
QLibrary
or as a plugin.For #1, when the application is run, the linked library needs to be available at startup, before any code runs. So the answer to your 1st question is definitely no. As to where it should be located, the simplest is to put it into the same folder as the executable which depends on it. After that it gets complicated if you want to support different OSs... Eg. Windows has its own rules, whereas on Linux you have LD_LIBRARY_PATH at run-time or rpath
at compile time (to name just a couple common options).
For #2 there is a lot more flexibility, including only loading the library(ies) if/when they're actually needed (which can, for example, improve startup time of your app). They can be located pretty much anywhere of your choosing (eg. a subfolder of your app distribution). But, I don't know about inside a resource file... I've never seen that mentioned or tried anywhere. I'm guessing not but it could be an interesting experiment! :)
Upvotes: 1