PDA

View Full Version : How to load the libraries in the Frameworks folder of the app using QLibrary on MacX?



gtthang
7th March 2006, 08:12
Hi,

I have a program using the QLibrary to load some libraries dynamically in code. At first, I copied the program and its libraries to a directory, created a script file to set some environment variables like PATH, DYLD_LIBRARY_PATH,... then run that script file from Terminal window to start the application, it works well.

But now, I want my application is able to be started from Finder window by double-clicking. So, I copied all libraries of the application to the Frameworks directory and used install_name_tool as mentioned in the document of Trolltech. Everything is ok but the libraries loaded by QLibrary don't work more, the QLibrary::load() method always return false. I have tried some different paths to those libraries in code but nothing changes.

Is there anyway to load the libraries in Frameworks directory using QLibrary?

Any help is appreciated.

Thanks very much.

zlatko
7th March 2006, 08:18
Always in situation like that best way - to use exetnded program like FileMonitor, that can tell you where exactly your app try to find needed library.

look here (http://www.sysinternals.com/)

gtthang
7th March 2006, 08:38
Always in situation like that best way - to use exetnded program like FileMonitor, that can tell you where exactly your app try to find needed library.

look here (http://www.sysinternals.com/)

Thanks for your suggestion,

I'm downloading that tool, but I have another question:

Can I change folder that the app looks for needed libraries? I tried the QCoreApplication::addLibraryPaths(),... but it seems that those methods are only used for plugins.

gtthang
7th March 2006, 08:38
Always in situation like that best way - to use exetnded program like FileMonitor, that can tell you where exactly your app try to find needed library.

look here (http://www.sysinternals.com/)

Thanks for your suggestion,

I'm downloading that tool, but I have another question:

Can I change folder that the app looks for its libraries? I tried the QCoreApplication::addLibraryPaths(),... but it seems that those methods are only used for plugins.

zlatko
7th March 2006, 08:52
First what i can tell you now - you can use environment vars, actually in win its LIB. Add needed you path there...how you can set it from Qt....it must be diggered :)