Results 1 to 2 of 2

Thread: Functionality of the QCoreApplication::addLibraryPath() method

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Functionality of the QCoreApplication::addLibraryPath() method

    Hello!

    I'ld like to know more about exactly what the named method is for or, more specifically, if it works for what I want.

    Given its name and its description in the help files, I understood that this function is used to append a different, non-default library path, that is, a path where Qt will try to locate libraries related to my application.

    Well, that seems exactly what I need: imaging me developing a series of Qt apps, all of each dinamically compiled, I noticed that a series of my applications installed on my computer would lead to a couple of Qt5Core.dll, Qt5Gui.dll, etc.. copied in one's computers, a quite waste of memory. Trying to surround this problem, I decided that all of my apps would be installed in the same folder (lets say, C:/Program Files/Momergil). But the result was that now I have a folder ("Momergil") with all, non repeated Qt dlls and lots of different executable files, each for one application - which is quite a mess. Trying to surround this new problem, I decided that I'ld like to put all the executables in a folder with the software's name, while this folder would be located in the original, now only for dlls directory.

    So for example, If I had a software called "Test.exe", I'ld set Inno Setup to put Qt5Core.dll, etc. in a folder called "C:/Program Files/Momergil" while "Test.exe" would be in "C:/Program Files/Momergil/Test".

    The problem is that now the .exe file wouldn't locate Qt's dlls. And here I thought addLibraryPath() would solve my problem (in this case, by adding "C:/Program Files/Momergil" with this method - or, more specifically, "./" or "../"), but it didn't.

    Searching about it on the web I found comments about this method only being valid for plugins, not for Qt's DLLS (in this case, shouldn't it be called "addPluginPath" instead?). Well, is this true? And if it is so, how could I tell my .exe that Qt's Dlls are in the folder they are? (not forgetting that this is relative to where the user decided to install all my apps).


    I'm glad for any help,

    Momergil

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Functionality of the QCoreApplication::addLibraryPath() method

    addLibraryPath() does indeed add library search base paths, but for runtime loaded libraries, e.g. plugins.

    It is code executed by the program once it has started, just like any other code that you as the application developer write. That is too late for start-up requirements, which need to be satisfiable by the systems dynamic linker.

    So this is actually not a Qt questions but rather a question of the target platform. You'll have to look for the system's library handling capabilties, e.g. if it allows to register libraries so that installers can find them, etc. Something to be better asked in a forum for the respective operating system.

    Your idea of having a "vendor" directory does seem quite good though. You have full control over it and it really doesn't matter if it contains a lot of files, nothing other then your installers will interact with it.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    Momergil (10th December 2013)

Similar Threads

  1. Replies: 3
    Last Post: 19th June 2012, 09:06
  2. Calling a method from a non-member method
    By AndresBarbaRoja in forum Newbie
    Replies: 5
    Last Post: 19th March 2011, 10:38
  3. Replies: 1
    Last Post: 25th November 2010, 11:37
  4. QCoreApplication
    By Morea in forum Qt Programming
    Replies: 5
    Last Post: 4th June 2007, 19:58
  5. spy++ like functionality with Qt / X11
    By bpetty in forum Newbie
    Replies: 3
    Last Post: 24th April 2007, 22:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.