How to use .dll in Boland C++

This is a discussion on How to use .dll in Boland C++ within the C Programming forums, part of the General Programming Boards category; Hi all. I use Borland C++ 5.02 and i want to use some features of a *.dll in my program. ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    6

    How to use .dll in Boland C++

    Hi all.
    I use Borland C++ 5.02 and i want to use some features of a *.dll in my program. I dont know how to make this library available in my code.
    Please help me.
    Thanks a lot.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    A DLL is a runtime library. If all you have is a DLL, you won't be able to use its code. You need a static library to link your program with. These static libraries are often called library.lib, or liblibrary.a.

    What DLL do you wish to use? Is the code for it freely available?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    You can use a DLL dynamically without a lib file by loading it into memory with the LoadLibrary() function, and then assigning a function pointer to the result of GetProcAddress(). This will give you the address of the function you wish to call. Go ahead and call it with the function pointer.

    If you don't know how to handle function pointers or things like that, this is probably too advanced for you at present. If, however, you're comfortable with those elements of C, then check out on MSDN as to how to use DLLs this way.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Is that right? That's interesting . . . Do those functions exist in Borland C++?

    Of course, unless you had a header file, you wouldn't be able to use macros and stuff like that that might make using the library easier.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Those are Windows API functions.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    I can tell, because of your reference to MSDN . . . but I've never used Borland C++, and I wasn't sure if the said compiler would support those Windows functions.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    If it's important, I can test it later perhaps, but I don't see a reason why they wouldn't support it. I know Borland's stuff supported various Windows API functions from past programs I've written with it, so again, I would expect these functions to be supported as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. possible to link and run with .lib file without .dll file?
    By George2 in forum Windows Programming
    Replies: 1
    Last Post: 05-25-2006, 09:05 PM
  2. Create .dll with Studio.NET in C++
    By vthokienj in forum C++ Programming
    Replies: 2
    Last Post: 02-09-2006, 06:21 AM
  3. Making a .dll
    By ninjaturtle[k9] in forum C++ Programming
    Replies: 7
    Last Post: 07-25-2004, 11:56 PM
  4. Problem with a .dll file
    By GaPe in forum Windows Programming
    Replies: 2
    Last Post: 10-29-2003, 12:20 PM
  5. How can I edit .dll files?
    By leskitten in forum C++ Programming
    Replies: 9
    Last Post: 07-29-2002, 03:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21