Results 1 to 13 of 13

Thread: QT with DLL ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    364
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 37 Times in 36 Posts

    Default Re: QT with DLL ?

    That's a very basic question - get your hands on a C++ book. Try the online book referenced here:
    http://doc.qt.nokia.com/4.7/how-to-learn-qt.html


    1) Have you tried mingw-utils - reimp and dlltool to create an import lib? Make sure you use the 0.3 version, not the latest.

    2) You might want to create a new project of type 'C++ Library' in Qt Creator. Then, assuming the source code you have is portable, add all cpp and h files to the project.

    3) You can also learn a lot from looking at how other projects work, for example qextserialport.

  2. #2
    Join Date
    Aug 2010
    Posts
    32
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2

    Default Re: QT with DLL ?

    Quote Originally Posted by schnitzel View Post
    2) You might want to create a new project of type 'C++ Library' in Qt Creator. Then, assuming the source code you have is portable, add all cpp and h files to the project.
    I'm not sure if the source code is portable, but I did it. It created a .a file not a .lib file.

    3) You can also learn a lot from looking at how other projects work, for example qextserialport.
    Didn't find this example.

  3. #3
    Join Date
    Oct 2009
    Posts
    364
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 37 Times in 36 Posts

    Default Re: QT with DLL ?

    Ok, if you created the .a file, then you should be able to link it to your app by specifying the following in your .pro file:

    Qt Code:
    1. LIBS += path/to/library/yourlib.a
    To copy to clipboard, switch view to plain text mode 

    about the qextserialport project, you can find it here: http://code.google.com/p/qextserialport/

    I have successfully built that library as dynamic and static.

  4. #4
    Join Date
    Aug 2010
    Posts
    32
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2

    Default Re: QT with DLL ?

    Quote Originally Posted by schnitzel View Post
    I have successfully built that library as dynamic and static.
    What library you are talking about? mpusbapi?

    And another question is if I want to link that library at run-time can I use the QLibrary?
    Last edited by digog; 3rd November 2010 at 03:42.

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
  •  
Qt is a trademark of The Qt Company.