Menu

How do I get Dev-C++ to work with a DLL?

Jonathan
2005-03-08
2012-09-26
  • Jonathan

    Jonathan - 2005-03-08

    I can't seem to figure it out.

    I tried #inport "qbxmlrp.dll"

    And got a ton of errors.

    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Makefile.win"
    Finding dependencies for file: C:\Dev-Cpp\Untitled1.cpp
    Executing make...
    make.exe -f "C:\Dev-Cpp\Makefile.win" all
    g++.exe -DDEBUG -c Untitled1.cpp -o Untitled1.o -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include" -I"C:/Program Files/Intuit/QuickBooks Enterprise Solutions" -g3

    In file included from Untitled1.cpp:3:
    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:1: error: stray '\144' in program
    In file included from Untitled1.cpp:3:
    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:1:4: warning: null character(s) ignored
    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:1: error: stray '\3' in program
    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:1:6: warning: null character(s) ignored
    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:1: error: stray '\4' in program

    ----------- lots more errors removed -------------

    C:/Program Files/Intuit/QuickBooks Enterprise Solutions/qbxmlrp.dll:22: error: expected declaration before '}' token

    make.exe: *** [Untitled1.o] Error 1

    Execution terminated

     
    • Anonymous

      Anonymous - 2007-04-04

      The errors you have are because you have added the dll directly to your project as a source file. The compiler will of course not be able to make sense of a binary DLL!

      You should really try to use the compiler that the DLL import library was intended for and link that explicitly (not compile it!). The import library will presumably be called qbxmlrp.lib and is most probably a VC++ import library. VC++2005 Express Edition is freely available and will probably work with this.

      If you must use MinGW/GCC then you have two choices:

      1) Convert the qbxmlrp.lib import library to a GNU library using teh reimp.exe utility.
      2) Load the library programatically using the Win32 LoadLibrary() function.

      Also if you continue to use MinGW/GCC do not use paths containing spaces as you have above. It is known to cause problems in many circumstances.

      Clifford

       
    • Nobody/Anonymous

      import is microsoft specific and cannot be used with Dev. For the dll to be imported to VC++, it must have been compiled to a intermeniate language using the MS .net framework.

       
    • Jonathan

      Jonathan - 2005-03-08

      What I really want to do is use the DLL with Dev-C++. What is the correct method to do this?

       
    • Jonathan

      Jonathan - 2005-03-08

      Thanks but I must be slow as after going through the first page of results I'm still not seeing how to do this.

      I did not make this DLL that I need to use.
      I did not have a dll.h file
      I am not trying to make a DLL

      I am trying to figure out how to use a DLL.

      I spent over an hour searching before asking this question and still can't figure out how to do this. It seems that I'm missing something obvious but what?

       
      • Marek Januszewski

        what dll are you trying to use? is it popular one or some custom dll?

        you would need some sort of .h file to use it, preferably also *.a that links to the dll, analogically to image libraries from dev-c++ devpaks. without that it's going to be harder - you can look at testdyngl.c in libsdl samples - it uses loadlibrary and getprocaddress, but you still need to know parameters each function has.

         
        • Marek Januszewski

          one day I will learn to look at previous posts. forget my questions about dll. I don't think the quickbooks sdk is for mingw. they clearly target vc++ users. I think it still could be possible to use that, but definitely it's harder than just #import some.dll

           
          • Nobody/Anonymous

            I've spent half a day trying without much luck. Has anyone been able to do this? The help file in Dev-C++ shows how to link in
            static libraries, but does not appear to cover dll's.

            Thanks in advance.

             
    • Nobody/Anonymous

      The #import statement is Microsoft specific and the dll has to have been with certain options. You can't do this with other compilers. You can still use the dll if you know which functions to call and their parameters. But you will have to load and call the dll explicitely. There is a Visual C utility that will list the exported functions but I can't recall the name.

      Do you know which functions you want to call and their parameters?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.