How to use an interface and a function that is present in a .dll



  • hi, i am new to qt. i m developing a tool for controlling a CCD. i have the drivers required and i have tried to include the .dll file in my program using QLibrary but i have no idea how to include the required interfaces and the corresponding functions in my program. i have no idea how to include it during the compiletime but since there is no particular header file.
    thanks in advance.



  • Hi sriharsha,

    there is no general answer to that. First you have to think of the interface. is it:

    pure C interface (only eC exported functions) in the dll

    C++ interface (exported classes from the dll)

    This has much influence on how to use it.

    If it's a C-interface, you can use late binding: Use "QLibrary":http://doc.qt.nokia.com/latest/qlibrary.html to load the library and "QLibrary::resolve":http://doc.qt.nokia.com/latest/qlibrary.html#resolve to get the function pointers. If you don't know how to use function pointers, you could look "here":http://www.cprogramming.com/tutorial/function-pointers.html or use google :-)

    If it's a C++ library you need the header files and an import library (on windows MSVS it would be a .lib file, for gcc a .a file). Without header and import lib file, I see no chance to use a C++ dll :-(


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.