Thread: Using .dll files

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    Using .dll files

    Hi all,
    Im doing a project where I need to call dll files (which has the drivers for certain hardware) and drive some digital outputs on the output lines of the hardware. How do I call the dll files in a C program ? what is the syntax for that ? Please comment.

    Thanx in advance

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    You can do this in two ways, euther by using a attached .lib/.h files(easiest), or by linking explicitly to the dll(You need to know the prototypes for the functions):
    Code:
    unsigned long (WINAPI *function1)(unsigned short, char*);
    HINSTANCE h1;
    
    if((h1 = LoadLibrary("dllname")) && ((FARPROC&)function1 = GetProcAddress(h1, "function1"))==NULL)
    	//Success
    else
    	//Failure

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create Copies of Files
    By Kanshu in forum C++ Programming
    Replies: 13
    Last Post: 05-09-2009, 07:53 AM
  2. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  3. Error opening files in a different dir
    By Ozzie in forum C++ Programming
    Replies: 3
    Last Post: 10-09-2008, 06:55 AM
  4. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 08:36 AM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM