Results 1 to 3 of 3

Thread: Howto: Use exported dll library functions in Qt

  1. #1
    Join Date
    Apr 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Howto: Use exported dll library functions in Qt

    Hi,

    I cannot figure out how to use functions from a 3rd party library for which I have the header file and the *.dll. The linker seems to have some problems which I cannot decipher. I have attached the header file and an I make ca call in my QtCode where I include the header file as follows:

    Qt Code:
    1. struct iaxc_audio_device *devices;
    2. int devNumber,input,output,ring;
    3. long devCapabilities;
    4. int result = iaxc_audio_devices_get(&devices, &devNumber, &input, &output, &ring);
    To copy to clipboard, switch view to plain text mode 

    My make gives the following output:

    Qt Code:
    1. g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -o "release\YakaPhone.exe" release\qrc_icons.o release\main.o release\mainwindow.o release\settingsdialog.o release\moc_mainwindow.o release\moc_settingsdialog.o -L"C:\Programme\Qt\4.1.2\lib" -lmingw32 -lqtmain -L"D:/Downloads/Tools/IDEs/Eclipse
    2. /eclipse/workspace/YakaPhone/lib" -lQtGui4 -lQtCore4
    3. release\settingsdialog.o(.text+0x8e):settingsdialog.cpp: undefined reference to `iaxc_audio_devices_get'
    4. collect2: ld returned 1 exit status
    5. mingw32-make[1]: *** [release\YakaPhone.exe] Error 1
    6. mingw32-make[1]: Leaving directory `D:/Downloads/Tools/IDEs/Eclipse/eclipse/workspace/YakaPhone'
    7. mingw32-make: *** [release] Error 2
    To copy to clipboard, switch view to plain text mode 

    Any clue how to reconfigure my project to make this work?
    Thanks for ur help.
    Roland (Newbie)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Howto: Use exported dll library functions in Qt

    Either use QLibrary or create an import library for that DLL as described in the MinGW FAQ.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Howto: Use exported dll library functions in Qt

    1) check you have a devel version (find an import lib : *.a or *.lib)
    if the lib is *.a goes to step 2 straightaway

    1) if the lib is *.lib (M$VC format) use reimp (mingw tools, use it via command line) to convert it in a mingw compatible import lib i.e *.a file

    2) add the following line to your project :

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

    where "../../lib/libXXX.a" is just an example path, use the one of your library

    3) qmake then mingw32-make
    Current Qt projects : QCodeEdit, RotiDeCode

  4. The following user says thank you to fullmetalcoder for this useful post:

    sector (14th July 2006)

Similar Threads

  1. name of exported dll functions
    By vrudolf in forum General Programming
    Replies: 2
    Last Post: 30th July 2006, 20:18

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.