View Full Version : DLL loading problem on Mac OSX

13th September 2010, 07:06
My Qt app uses QLibrary to access a function in a DLL (actually .dylib). The program works fine on Windows and Linux, but I'm having trouble loading the DLL on Mac OSX.

QLibrary myLib(dll_path);

fails to load the DLL. Apparently it can't find it, although I can't be totally sure, since

errStr = myLib.errorString();

returns "Unknown error"

In any case I don't know where the app looks to find the DLL. I started by putting it in /usr/local/lib, Unix-style. I then put it in the same directory as the executable, then I tried putting it in the package, in Contents/Plugins, and adding this to main.cpp

app.addLibraryPath(app.applicationDirPath() + "/../Plugins");

but the load always fails. Can someone help?

16th September 2010, 08:24
The answer: DLL built for i386, different architecture from the main program build. I only discovered this when I gave up on the runtime loading, and tried to load the DLL at compile time - the linker immediately gave me the info I needed in an error message.