Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Dll's in subfolder of exe?



  • Dear Volker (or who else is up at night),

    I'd like to put the shared dlls in a subfolder of my .exe-file but up until know it only recognizes them while they are in the same folder as the .exe.
    How can I change this?



  • DLL dependencies are searched for in a designated search path, usually being appdir + %PATH%. You would have to add the subdir to your dll search path for this to work, thus requiring some batch-file-magic. I wouldn't bother too much with this to be honest, because people on windows use (should use) short-cuts anyway.



  • Thanks for the explanation.
    You are right. That isn't worth the trouble.

    I know a lot of my users aren't too tech-savy plus my tools are always portable. That means they could be confused by the shitload of .dll's in the application-folder.

    Is there a way to put some .dll's together or put them in the .exe-file itself WITHOUT statically binding or subverting the LGPL-license agreements?



  • Not that I know of, no.
    You do not need that many .dll's, I think. Just the Qt modules you use, plus the compiler runtime. Do you use all of Qt's modules?



  • It's not that many. I use 11.



  • As long as there is only one executable in the directory, there isn't much they can do wrong, no?



  • [quote author="Franzk" date="1305625156"]As long as there is only one executable in the directory, there isn't much they can do wrong, no?[/quote]

    From the point of view of a healthy human, yes.
    You should see the questions people sometimes ask on my blog about my other tools.

    I guess it comes down to survival of the fittest. If you can't find the .exe you shouldn't use the tool.



  • If there's really a lot of non-savvy users, you should create an installer and be done with it.

    Or tell people how to create a short cut in their start menu.



  • I would recommend creating an installer too. I use "InnoSetup":http://www.jrsoftware.org/isinfo.php with great success, others use "NSIS":http://nsis.sourceforge.net/Main_Page. If you're brave you can have a look at Qt's own "Installer Framework":https://qt.gitorious.org/qt-labs/installer-framework on the labs.

    Those make it easy to setup desktop icons, taskbar shortcuts and application menu entries. Additionally, the installers (at least Inno and NSIS) support updates, so when a new version of your software is out, the users would not have to fiddle around themselfs, but the installer replaces the necessary pieces.



  • Thanks for your suggestions but I'm a die-hard portable application advocate.



  • Hm? You lost me :-) You mean portable in a sense of Win/Mac/Linux or in the sense of having just an application folder that you can drag between different workstations of the same os?



  • Sorry, for not being clear.

    I mean portable in a sense of "Put that folder wherever you want and never care about it again".



  • Hi Hedge,

    for which platform do you do that?
    There are platform dependent ways to achieve new dll directories (e.g. for windows, you can call SetDllDirectory: http://msdn.microsoft.com/en-us/library/ms686203(VS.85).aspx ).

    [EDIT: fixed link, Volker]



  • Ah, ok :-)

    That should work. Windows has alias files (files ending in .lnk if shown on another OS). I don't know if these work on absolute or relative path names. If they work on relative paths, you can put everything, including the exe, in a subdirectory and have an alias point to your exe). But as said, I don't know if that still works if you move the directory to another direction or copy it to another windows box.



  • My aplication will be on OSX and Windows.
    On OSX I'm already pleased with the structure.

    On Windows I'll try your suggestion.



  • [quote author="Gerolf" date="1305629162"]Hi Hedge,

    for which platform do you do that?
    There are platform dependent ways to achieve new dll directories (e.g. for windows, you can call SetDllDirectory: http://msdn.microsoft.com/en-us/library/ms686203(VS.85).aspx ).

    [EDIT: fixed link, Volker][/quote]

    That will not work as it needs a running application and application startup will fail on missing QtCore4.dll



  • That's correct, not for startup, I forgot.
    I used this for dynamically loaded dll with loadLibrary...

    and it does not create link files, it just expands the dll search path for a while :-)


Log in to reply