Developing Your Application Chapter 3
NI-488.2 User Manual for Windows 3-20 © National Instruments Corp.
Method 2. Generate an Import Library Using implib
To use the second method, link the application to an import library generated from the
DLL using the
implib utility.
To generate the import library, type in the following text:
implib gpib.lib c:\windows\system\gpib.dll
where c:\windows\system\ is the path to your Windows System directory. The file
named gpib.lib is the name of the file generated by the implib utility. For more
information about the implib utility program, refer to the Windows online help or other
documentation supplied with your compiler.
After you have written your Microsoft C application program, compile your program and
use the /Mq option of Microsoft C to create a QuickWin application. This option is
available starting with Microsoft C/C++ Version 7.0 with the Microsoft Software
Development Kit (SDK) or with Microsoft Visual C++ Version 1.x. The following
command compiles and links a Microsoft QuickWin application named cprog with the
import library file gpib.lib:
cl /Mq cprog.c gpib.lib
After you have written your Borland C/C++ application program, compile your program
and use the -W option of Borland C/C++ to create a Windows application. The following
command compiles and links a Borland C/C++ Windows application named cprog with
the import library file gpib.lib:
bcc -W cprog.c gpib.lib
To run your application, choose the Run option from the File menu in the
Program Manager window. Enter the path and name of the compiled program in the
dialog box that appears.
The third method of accessing the DLL follows.
Method 3. Use LoadLibrary and GetProcAddress
To use the third method, use the LoadLibrary and GetProcAddress functions to
load the library and retrieve a pointer to the function.
The Direct Entry sample programs use this method. At the beginning of your program,
declare the following global variable for the DLL as follows:
HINSTANCE GpibLib = NULL;