National Instruments PC-OPDIO-16 Telescope User Manual


 
Chapter 4 The Fundamentals of Building Applications with NI-DAQ
© National Instruments Corporation 4-9 PC-OPDIO-16 User Manual
Huge (Greater Than 64 KB) Buffer Access
Buffers of allocated memory that exceed 64 KB are divided into 64 KB groups, or segments.
When you are accessing data within the buffer and you reach the end of one of these segments
and must reference the next segment, you need some way of finding the address of the next
segment. This event is called crossing a segment boundary. Some languages have special types
of pointers that make this crossing transparent to the programmer; other languages require you to
perform your own pointer arithmetic using a Windows-supplied constant to increment your
pointer address.
String Passing
When NI-DAQ for Windows routines call for a string that is passed as a parameter, the routines
expect a pointer to a null-terminated string. Some languages require special string handling to
support this type.
Parameter Passing
You can pass procedure or function parameters by value or by reference. Different languages
have different default settings. You must be sure to pass certain variables by value or by
reference to each NI-DAQ for Windows function.
Creating a Windows Application Using Borland C++
This section assumes that you will be using the Borland IDE to manage your code development.
For Windows programs in general, remember to follow this procedure:
1. Open a project module to manage your application code.
2. Create files of type .cpp (C++ source code).
3. Set Options\Application to Windows App to set options similar to those used in a module
definition file.
4. Create your resources using the Borland Whitewater Resource Toolkit. After you have
created the resources, save them into a .res file and add the .res file to the list of files for
the project window.
To use the NI-DAQ functions, you must use the NI-DAQ DLL. Follow this procedure:
1. Create your source file as you would for other Windows programs written in C++, calling
NI-DAQ functions as typical function calls.
2. Prototype any NI-DAQ routines used in your application. Include the NI-DAQ header file,
which prototypes all NI-DAQ routines, as shown in the following example:
#include "WDAQ_BC.H"
3. Add the NI-DAQ import library NIDAQ.LIB to the project module.