Important: Please read the Qt Code of Conduct -

Declaring a function from .dll in Qt4

  • Situation: I have a .dll file for focas2 libraries. I am trying to use the functions contained within the .dll (I am using the Qt Creator on windows).

    I have successfully used the functions in by using the following code snippets for the function defines contained within the .dll file. Fortunately, things work like magic once these functions are defined in a module or something of that sort and are linked to the dll. I have a list of the functions within the dll and their input arguments in which I used in my app like in the example shown below...

    Declare Function some_function_name1 Lib "dllname.dll" (ByVal functioninput as Integer, ByVal functioninput as Double) as Integer
    Declare Function some_function_name2 Lib "dllname.dll" (ByVal functioninput as Integer, ByVal functioninput as Double) as Integer
    Note: those are just dummy examples

    So I pose this question, how do I use this functionality in Qt4. Or even, does it exist? All of these function defines need to be located in a header file like I would do in, one would assume.

    The dll is located in my project folder in a known directory, I know I can link the library some how in the .pro file using "LIBS +=" and also including the directory. Figuring that out is the least of my worries right now though.

    Thank you in advance.

  • Moderators

    I guess this depends a lot on what this focas2 dll actually is: There should be no problem with C and C++ libraries.

    Since you are using with this library I do assume though that it is a .net dll. I do not know whether/how to make .net interoperate with C++. Maybe one of our windows users can shed some light on this issue.

  • Actually, I know for a fact that these libraries I am trying to use (the dll) is a 32 bit windows API library. This might make this easier??

Log in to reply