Thread: how to call a DLL functions in VC++

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    2

    Angry how to call a DLL functions in VC++

    To all,

    good day!....
    this is my 1st time in programming to call a DLL functions in VC++.
    pls give me an idea on how to setup the dll file to make visible in my program and to use its available functions.

    waiting a reply. thanks.

    michael

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    A search is your best bet. There is plenty of advice on DLL's.

    First though,
    Is it your DLL, ie are you going to implicitly or explicitly link the DLL? (Use a library or load a t runtime)

    Do you need to run a dependancy walker to find/check the exported functions?

    This tool comes with MSVC, just run Depends.exe and drag the DLL into it to find what functions are available and what the DLL is dependant on.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    2
    thanks you for your reply novocain.

    the type of dll am going to use is to load at runtime.

    actually, i have the header file .h and .lib of that dll, but i don't know how to link in my program.

    thanks.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    Well for starters, you'll need LoadLibrary() and FreeLibrary(). Those deal with a HINSTANCE which represents the dll. Second, GetProcAddress() will give you a pointer to the function you need. Search on those functions to get started

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    If you have the lib can link impilcitly which is slightly easier.

    Or expilictly with the GetProcAddress() ect.

    Run a search here on 'dll*' (search must be at least 4 letters long) for some more code. Ask again if you have problems.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to create DLL file in C language and call from C and VB
    By karthickbabu in forum C Programming
    Replies: 2
    Last Post: 10-24-2007, 07:50 AM
  2. Calling App Functions from DLL
    By johnnie2 in forum Windows Programming
    Replies: 3
    Last Post: 03-19-2003, 01:08 AM
  3. Call Back functions
    By ladhnur in forum C Programming
    Replies: 8
    Last Post: 08-22-2002, 08:58 AM
  4. Knowing the Functions a DLL is offering
    By vsriharsha in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2002, 05:16 AM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM