National Instruments PC-OPDIO-16 Telescope User Manual


 
Chapter 4 The Fundamentals of Building Applications with NI-DAQ
© National Instruments Corporation 4-5 PC-OPDIO-16 User Manual
your LIB environment variable so the linker can find the libraries. The following statement
is an example of how to set the LIB environment variable in your autoexec.bat file:
SET LIB=C:\NIDAQDOS\LIB;C:\VBDOS\LIB
Example Programs
You can find a set of example programs and the necessary header files in the
NIDAQDOS\BASIC_EX directory.
Creating a DOS Application Using Borland Turbo C++ or Borland C++
The NI-DAQ libraries for Borland Turbo C++ and Borland C++ are compiled using the large
memory model. Therefore, it is essential that you install the large memory model of your C++
compiler.
To create your application that calls NI-DAQ functions, you first create source code. Follow the
instructions in this chapter when making NI-DAQ function calls. Be sure to use the function
prototypes by including NIDAQ.H in your source file.
Note: You must call the USE function in your application before calling any other NI-DAQ
functions. This function causes portions of the NI-DAQ library that are required to use
your DAQ product to be included in your application. If you do not call the appropriate
USE function, your other NI-DAQ functions will return error -421
(functionNotLinkedErr).
To compile and run your application, it is recommended that you use the Integrated
Development Environment (IDE). You can find example project files created in version 3.1 in
the NI-DAQ C_EX directory. Newer versions of Borland C++ can use 3.1 project files.
To run your application using the IDE, you must follow these guidelines:
1. Open a project to manage your application code. Include the NI-DAQ library
NIDAQBC.LIB along with the source file in your project.
2. Choose Options | Compiler | Code Generation from the main menu. A dialog box will be
displayed. Set the Model button to Large. This will direct the compiler to use the large
memory model.
3. Choose Options | Directories from the main menu. A dialog box will be displayed that lets
you set the path for include files, libraries, and so on. Add the path to NI-DAQ LIB
subdirectory. Also add the path to the NI-DAQ C_EX directory to the include path.