Access Functions in a Dll

This is a discussion on Access Functions in a Dll within the C++ Programming forums, part of the General Programming Boards category; Hi, I am fairly clueless when it comes to C++, so I'd appreciate any help. So.... I have a dll ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Location
    Ballincollig, co. cork, Eire
    Posts
    22

    Access Functions in a Dll

    Hi,

    I am fairly clueless when it comes to C++, so I'd appreciate any help.

    So.... I have a dll for a machine. What exactly do I do with it? i.e. How do I include it into the code, access and use the functions inside it, etc.

    Regards

    Brownie

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You need more than the DLL - you need a .lib file as well to be able to find out what the functions are inside the DLL, and a .h file so that your compiler can connect the dots between the source and the .lib file.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Location
    Ballincollig, co. cork, Eire
    Posts
    22
    Ok so..... Found all that stuff. So what do I do with it? I'm guessing I include the headers as normal, but what about the .dll and the .lib

    Brownie

    [Windows XP & Visual C++ 2005 Express Edition]

  4. #4
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    You might have to point express to the directory (if it's like '03 Tools->Options->Projects->VC++Directories-> modify paths in drop down menu. Library files to where the dll/lib are and header files to where the header is). Alternatively throw 'em all into the project directory from which you're working. Then type in #pragma comment( lib, "my_lib_file.lib" ) and #include "my_lib_file.h" and call a function from the dll, as per the header file.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You link with the .lib file ["additional inputs" or some such in the Visual Studio project Linker tab], and place the DLL where it can be found when running the application (say the same directory as the .exe file).

    Of course, you may need to follow certain steps to use the functions in the DLL. As you haven't told us what DLL you are trying to use, I can't even guess what that may involve.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Feb 2006
    Location
    Ballincollig, co. cork, Eire
    Posts
    22
    Thanks for the help Mats and Twomers. I'll try that out later and see how it works

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-26-2008, 08:44 AM
  2. access functions from another c file
    By Ron in forum C Programming
    Replies: 1
    Last Post: 07-19-2008, 07:14 PM
  3. Calling App Functions from DLL
    By johnnie2 in forum Windows Programming
    Replies: 3
    Last Post: 03-19-2003, 12:08 AM
  4. DLL & free() Heap Access Violation
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 08-13-2002, 10:45 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM

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