National Instruments NI-488.2 Time Clock User Manual


 
Chapter 3 Developing Your Application
© National Instruments Corp. 3-19 NI-488.2 User Manual for Windows
Sample programs using direct entry are included with the National Instruments driver.
The C sample programs are console-type applications. They illustrate how to use the
function calls the NI-488.2 driver exports. Since most of the popular compilers support
console-type applications as well as GUI applications, you can create console-type
applications without knowing Windows GUI programming. A console-type application
is a Win16 program that uses text-based input and output instead of a graphical interface.
This allows you to quickly create a Win16 application by using simple input and output
functions like printf and scanf.
You must define the direct entry prototypes of the functions used in your application
program. There are three methods of accessing the Dynamic Link Library (DLL)
directly. The NI-488.2 Function Reference Manual for DOS/Windows provides the
format for the first two methods. Refer to it for the C direct entry syntax for NI-488
functions and NI-488.2 routines. The direct entry sample programs use the third method.
The three methods of direct entry are documented in the Microsoft Windows Software
Development Kit (SDK) Guide's online help file. The first method of accessing the DLL
follows.
Method 1. List Functions in the Module Definition File
To use the first method, list the names of the functions in the imports section in the
application's .def file.
You must create a module definition file, such as cprog.def. This file contains an
imports section that lists the direct entry points used by the application program. You
must link the module definition file to your application program.
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
module definition file cprog.def:
cl /Mq cprog.c cprog.def
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 module definition file cprog.def:
bcc -W cprog.c cprog.def
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 second method of accessing the DLL follows.