Results 1 to 5 of 5

Thread: Embedding a custom DLL on Mac

  1. #1
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Embedding a custom DLL on Mac

    I want to build a Qt project that uses another Qt project. I have (barely, and with little help from the docs) got this working with the embedded project as a static library, but want to make it work with dynamic libraries.

    I figured the first step would be changing the staticlib in the library project to be dll. That's got the library compiling and linking again, although until I get something using it I'm not sure it's really working.

    I removed the output statlic library and ran qmake on the application project, and that seems to compile and link. The result won't run, apparently because it can't find the library. I'm not sure where the library should be within the bundle, though.

    Ideally, I'd like for the application project to build an application with the dylib output by the library project copied into the appropriate place in the application bundle.

    Any tips?
    Last edited by sdfisher; 26th March 2007 at 20:36.

  2. #2
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embedding a custom DLL on Mac

    Quote Originally Posted by sdfisher View Post
    Ideally, I'd like for the application project to build an application with the dylib output by the library project copied into the appropriate place in the application bundle.
    That's the easy part! :-) Just put them in the Frameworks directory. Even if they're not true frameworks, you can put them in there. See http://doc.trolltech.com/4.2/deployment-mac.html for more information.

    The hard part, if you read the above link, is getting the application to find them. Apple has not made this easy. You need to get the application to point to the shared libraries, and for the shared libraries to point to each other (QtGui needs to know where to find QtCore, for example). The commands to do this are obtuse, so I wrote a script to do it. This assumes you are using the command line and makefiles, but it should easily be adapted for XCode use. I've put it up on the wiki at http://wiki.qtcentre.org/index.php?t...loyment_Script

  3. The following 2 users say thank you to Brandybuck for this useful post:

    sdfisher (27th March 2007), xgoan (27th March 2007)

  4. #3
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embedding a custom DLL on Mac

    I have tried the shell script and it works and creates the .dmg file.

    But when moved the file to another Mac the QMYSQL driver is not found

  5. #4
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embedding a custom DLL on Mac

    This script prepares a Qt application bundle for deployment. It will
    copy over the required Qt frameworks and sets the installation
    identifications. Please see the "Deploying an Application on Qt/Mac"
    page in the Qt documentation for more information.

    This script assumes you have already built the application bundle.

    What is the name of the application? konstructor
    application: konstructor
    bundle: konstructor.app
    Using frameworks QtSql QtGui QtCore
    Running make install
    make: Nothing to be done for `install'.
    Copying QtSql framework
    Copying QtGui framework
    Copying QtCore framework
    Setting framework IDs...Setting framework IDs... QtSql QtGui QtCore
    Changing framework paths for konstructor... QtSql QtGui QtCore
    Fixing bundled frameworks... QtSql QtGui QtCore
    Creating disk image
    .................................................. .................................................. .......................................
    created: /Users/David/Desktop/konstructor/konstructor.dmg
    hdiutil: internet-enable: enable succeeded
    Done
    The script output

  6. #5
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Embedding a custom DLL on Mac

    Thanks! The only thing not clear to me at this point is if it is possible to have qmake build an Xcode project that automatically makes the Frameworks directory an d copies my framework to it. I'm content to have to copy the Qt frameworks there manually since they're always on my development system's search path and I only really need to copy them to deploy, but it's a greater pain with my custom library. Or would a better strategy to try to make my library project build to i.e. ~/Library/Frameworks?

Similar Threads

  1. Replies: 1
    Last Post: 5th March 2007, 20:50
  2. Custom Widget Plugin Analog Clock
    By kemp in forum Qt Programming
    Replies: 8
    Last Post: 11th August 2006, 13:22
  3. Custom Qt dll name
    By tony007 in forum Installation and Deployment
    Replies: 2
    Last Post: 10th March 2006, 15:29
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. Replies: 4
    Last Post: 1st March 2006, 23:11

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.