Menu

How to call/link a DLL?

2002-12-04
2012-09-26
  • Nobody/Anonymous

    I am a newbie in win programming and I started use DEVC++ last week.
    I have to call a bastard.dll,
    I have also bastard.h bastard.lib and a manual about exported calls of bastard.dll.
    I put #include "bastard.h" in my calling program.
    But I got a linker error.
    Than I put in Project/properties linker-option:
    -l"bastard.lib"
    But I continue to got link errors, even placing the file
    bastard.lib in several directories....
    Please, help me

     
    • Nobody/Anonymous

      Hmm,is not the syntax for tha something like:

      -lbastard

      I usually put such a thing under compiler:options, which is probably not as effecient..

      By the way, what version of Dev are you running?

      Wayne

       
    • Nobody/Anonymous

      Dinamically? If thats the case use LoadLibrary. Check that at the win API reference.

       
    • Nobody/Anonymous

      Hy Wayne,
      -lbastard did not solve.
      I use v.4.9.6.0
      I don't want to use LoadLibrary because I know at compile time the name of the DLL to call.
      In real life bastard=thinapi and this is my compile log:
      ..................
      g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/g++-3"  -I"C:/Dev-Cpp/include"   -g3 -mwindows

      windres.exe -i WINMEN~1.RC -I rc -o WinMenu_private.res -O coff

      g++.exe main.o WinMenu_private.res -o "ThinClient.exe" -L"C:/Dev-Cpp/lib" -lThinApi.lib -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/g++-3"  -I"C:/Dev-Cpp/include"   -g3 -mwindows

      C:\Dev-Cpp\Bin\..\lib\gcc-lib\mingw32\2.95.3-6\..\..\..\..\mingw32\bin\ld.exe: cannot find -lThinApi.lib

      make.exe: *** [ThinClient.exe] Error 1
      .........................................................
      Thanks for more suggestion

      Rino

       
    • Nobody/Anonymous

      Real stupid question, it looks like the error is coming from trying to do:

      -lThinAPI.lib

      Isn't that syntax wrong, I didn't think you were supposed to have the .lib on there.

      Probably a stupid question.  I quit linking when I got married.

      ;-)

      Wayne

       
    • Nobody/Anonymous

      Hy Wayne,
      -lbastard did not solve.
      I use v.4.9.6.0
      I don't want to use LoadLibrary because I know at compile time the name of the DLL to call.
      In real life bastard=thinapi and this is my compile log:
      ..................
      g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/g++-3"  -I"C:/Dev-Cpp/include"   -g3 -mwindows

      windres.exe -i WINMEN~1.RC -I rc -o WinMenu_private.res -O coff

      g++.exe main.o WinMenu_private.res -o "ThinClient.exe" -L"C:/Dev-Cpp/lib" -lThinApi.lib -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include/g++-3"  -I"C:/Dev-Cpp/include"   -g3 -mwindows

      C:\Dev-Cpp\Bin\..\lib\gcc-lib\mingw32\2.95.3-6\..\..\..\..\mingw32\bin\ld.exe: cannot find -lThinApi.lib

      make.exe: *** [ThinClient.exe] Error 1
      .........................................................
      Thanks for more suggestion

      Rino

       
    • Nobody/Anonymous

      Was your repost accidental, or a subtle way of sending a message?  If the latter, note your error message:

      C:\Dev-Cpp\Bin\..\lib\gcc-lib\mingw32\2.95.3-6\..\..\..\..\mingw32\bin\ld.exe: cannot find -lThinApi.lib

      to see why I asked my question.

      Wayne

       

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.