Programming Refrence For Labwindows Cvi
Programming Refrence For Labwindows Cvi
LabWindows/CVI
Programmer
Reference Manual
LabWindows/CVI Programmer Reference Manual
Internet Support
E-mail: [email protected]
FTP Site: ftp.natinst.com
Web Address: http://www.natinst.com
Bulletin Board Support
BBS United States: 512 794 5422
BBS United Kingdom: 01635 551422
BBS France: 01 48 65 15 59
Fax-on-Demand Support
512 418 1111
Telephone Support (USA)
Tel: 512 795 8248
Fax: 512 794 5678
International Offices
Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazil 011 288 3336,
Canada (Ontario) 905 785 0085, Canada (Qubec) 514 694 8521, Denmark 45 76 26 00, Finland 09 725 725 11,
France 01 48 14 24 24, Germany 089 741 31 30, Hong Kong 2645 3186, Israel 03 6120092, Italy 02 413091,
Japan 03 5472 2970, Korea 02 596 7456, Mexico 5 520 2635, Netherlands 0348 433466, Norway 32 84 84 00,
Singapore 2265886, Spain 91 640 0085, Sweden 08 730 49 70, Switzerland 056 200 51 51, Taiwan 02 377 1200,
United Kingdom 01635 523545
National Instruments Corporate Headquarters
6504 Bridge Point Parkway Austin, Texas 78730-5039 USA Tel: 512 794 0100
Copyright 1994, 1998 National Instruments Corporation. All rights reserved.
Important Information
Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming
instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced
by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not
execute programming instructions if National Instruments receives notice of such defects during the warranty period.
National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside
of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs
of returning to the owner parts which are covered by warranty.
National Instruments believes that the information in this manual is accurate. The document has been carefully reviewed
for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to
make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should
consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages
arising out of or related to this document or the information contained in it.
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS
ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE . CUSTOMER S RIGHT TO RECOVER DAMAGES CAUSED
BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE
CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS ,
OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the liability of
National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence.
Any action against National Instruments must be brought within one year after the cause of action accrues. National
Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty
provided herein does not cover damages, defects, malfunctions, or service failures caused by owners failure to follow
the National Instruments installation, operation, or maintenance instructions; owners modification of the product;
owners abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or
other events outside reasonable control.
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical,
including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without
the prior written consent of National Instruments Corporation.
Trademarks
CVI, National Instruments, the National Instruments logo, natinst.com , and The Software is the Instrumentare
trademarks of National Instruments Corporation.
Product and company names listed are trademarks or trade names of their respective companies.
Contents
About This Manual
Organization of This Manual ...........................................................................................xiii
Conventions Used in This Manual...................................................................................xiv
Related Documentation .....................................................................................xv
Customer Communication.................................................................................xvi
Chapter 1
LabWindows/CVI Compiler
Overview..........................................................................................................................1-1
LabWindows/CVI Compiler Specifics ............................................................................1-1
Compiler Limits.................................................................................................1-1
Compiler Options ..............................................................................................1-2
Compiler Defines...............................................................................................1-2
C Language Non-Conformance .......................................................................................1-2
C Language Extensions ...................................................................................................1-2
Keywords That Are Not ANSI C Standard .......................................................1-2
Calling Conventions (Windows 95/NT Only)...................................................1-2
Import and Export Qualifiers.............................................................................1-3
C++ Comment Markers.....................................................................................1-4
Duplicate Typedefs............................................................................................1-4
Structure Packing Pragma (Windows 3.1 and Windows 95/NT Only).............1-4
Program Entry Points (Windows 95/NT Only) .................................................1-5
C Library Issues ...............................................................................................................1-5
Using the Low-Level I/O Functions..................................................................1-5
C Data Types and 32-Bit Compiler Issues.......................................................................1-6
Data Types.........................................................................................................1-6
Converting 16-Bit Source Code to 32-Bit Source Code ...................................1-6
Debugging Levels ............................................................................................................1-8
User Protection ................................................................................................................1-8
Array Indexing and Pointer Protection Errors...................................................1-8
Pointer Arithmetic (Non-Fatal) ...........................................................1-8
Pointer Assignment (Non-Fatal) .........................................................1-9
Pointer Dereference Errors (Fatal) ......................................................1-9
Pointer Comparison (Non-Fatal).........................................................1-10
Pointer Subtraction (Non-Fatal)..........................................................1-10
Pointer Casting (Non-Fatal) ................................................................1-10
Dynamic Memory Protection Errors .................................................................1-11
Memory Deallocation (Non-Fatal)......................................................1-11
Memory Corruption (Fatal).................................................................1-11
Contents
Chapter 2
Using Loadable Compiled Modules
About Loadable Compiled Modules ............................................................................... 2-1
Advantages and Disadvantages of Using Loadable Compiled Modules
in LabWindows/CVI ...................................................................................... 2-2
Using a Loadable Compiled Module as an Instrument Driver
Program File................................................................................................... 2-2
Using a Loadable Compiled Module as a User Library.................................... 2-3
Using a Loadable Compiled Module in the Project List................................... 2-3
Using a Loadable Compiled Module as an External Module ........................... 2-4
Notification of Changes in Run State ............................................................... 2-4
Example 1 ........................................................................................... 2-5
Example 2 ........................................................................................... 2-6
Using Run State Change Callbacks in a DLL................................................... 2-6
Compiled Modules that Contain Asynchronous Callbacks .............................. 2-7
Chapter 3
Windows 95/NT Compiler/Linker Issues
Loading 32-Bit DLLs under Windows 95/NT ................................................................ 3-1
DLLs for Instrument Drivers and User Libraries.............................................. 3-2
Using The LoadExternalModule Function ....................................................... 3-2
Link Errors when Using DLL Import Libraries................................................ 3-2
DLL Path (.pth) Files Not Supported................................................................ 3-2
16-Bit DLLs Not Supported.............................................................................. 3-2
vi
Contents
vii
Contents
Chapter 4
Windows 3.1 Compiler/Linker Issues
Using Modules Compiled by LabWindows/CVI ............................................................ 4-1
Using 32-Bit Watcom Compiled Modules under Windows 3.1...................................... 4-1
Using 32-Bit Borland or Symantec Compiled Modules under Windows 3.1 ................. 4-2
16-Bit Windows DLLs .................................................................................................... 4-3
Helpful LabWindows/CVI Options for Working with DLLs ........................... 4-4
DLL Rules and Restrictions.............................................................................. 4-4
viii
Contents
Chapter 5
UNIX Compiler/Linker Issues
Calling Sun C Library Functions .....................................................................................5-1
Restrictions on Calling Sun C Library Functions..............................................5-1
Using Shared Libraries in LabWindows/CVI..................................................................5-2
Using dlopen......................................................................................................5-2
The LabWindows/CVI Run-Time Engine as a Shared Library.......................................5-2
Creating Executables that Use the LabWindows/CVI Libraries .....................................5-3
Compatible External Compilers ........................................................................5-3
Static and Shared Versions of the ANSI C and Other Sun Libraries ................5-3
Non-ANSI Behavior of Sun Solaris 1 ANSI C Library ....................................5-4
LabWindows/CVI Implements printf and scanf................................................5-4
Main Function Must Call InitCVIRTE..............................................................5-4
Run State Change Callbacks Are Not Available in Executables ......................5-5
Using Externally Compiled Modules ..............................................................................5-6
Restrictions on Externally Compiled Modules..................................................5-6
Compiling Modules With External Compilers..................................................5-6
Locking Process Segments into Memory Using plock() .................................................5-7
UNIX Asynchronous Signal Handling ............................................................................5-7
ix
Contents
Chapter 6
Building Multiplatform Applications
Multiplatform Programming Guidelines ......................................................................... 6-1
Library Issues .................................................................................................... 6-1
Externally Compiled Modules .......................................................................... 6-3
Multiplatform User Interface Guidelines ........................................................................ 6-3
Chapter 7
Creating and Distributing Standalone Executables and DLLs
Introduction to the Run-Time Engine.............................................................................. 7-1
Distributing Standalone Executables under Windows...................................... 7-1
Minimum System Requirements for Windows 95/NT....................... 7-1
No Math Coprocessor Required for Windows 95/NT........................ 7-2
Minimum System Requirements for Windows 3.1 ............................ 7-2
Math Coprocessor Software Emulation for Windows 3.1.................. 7-2
Distributing Standalone Executables under UNIX ........................................... 7-2
Distributing Standalone Executables under Solaris 2......................... 7-3
Distributing Standalone Executables under Solaris 1......................... 7-4
Minimum System Requirements for UNIX........................................ 7-5
Translating the Message File ............................................................................ 7-5
Configuring the Run-Time Engine.................................................................................. 7-5
Solaris 1 Patches Required for Running Standalone Executable...................... 7-5
Configuration Option Descriptions................................................................... 7-6
cvirtx (Windows 3.1 Only) ................................................................. 7-6
cvidir (Windows Only) ....................................................................... 7-7
useDefaultTimer (Windows Only) ..................................................... 7-7
DSTRules............................................................................................ 7-7
UNIX Options..................................................................................... 7-7
Necessary Files for Running Executable Programs ........................................................ 7-8
Necessary Files for Using DLLs Created in Windows 95/NT ........................................ 7-9
Location of Files on the Target Machine for Running Executables and DLLs............... 7-9
LabWindows/CVI Run-Time Engine under Windows 95/NT ......................... 7-10
Run-Time Library DLLs .................................................................... 7-10
Low-Level Support Driver ................................................................. 7-10
Contents
Chapter 8
Distributing Libraries and Function Panels
How to Distribute Libraries .............................................................................................8-1
Adding Libraries to Users Library Menu .......................................................................8-1
Specifying Library Dependencies....................................................................................8-2
Chapter 9
Checking for Errors in LabWindows/CVI
Error Checking.................................................................................................................9-2
Status Reporting by LabWindows/CVI Libraries and Instrument Drivers......................9-3
User Interface Library .......................................................................................9-3
Analysis/Advanced Analysis Libraries .............................................................9-3
Easy I/O for DAQ Library.................................................................................9-4
Data Acquisition Library ...................................................................................9-4
VXI Library .......................................................................................................9-4
GPIB/GPIB 488.2 Library.................................................................................9-4
RS-232 Library..................................................................................................9-5
VISA Library.....................................................................................................9-5
IVI Library.........................................................................................................9-5
TCP Library.......................................................................................................9-6
DDE Library......................................................................................................9-6
xi
Contents
Appendix A
Errors and Warnings
Appendix B
Customer Communication
Glossary
Figures
Figure 7-1.
Tables
Table 1-1.
Table 1-2.
Table 1-3.
Table 7-1.
Table 7-2.
Table 7-3.
Table A-1.
xii
xiii
The Index contains an alphabetical list of key terms and topics used in
this manual, including the page where each one can be found.
The symbol leads you through nested menu items and dialog box options
to a final action. The sequence FilePage SetupOptions Substitute
Fonts directs you to pull down the File menu, select the Page Setup item,
select Options, and finally select the Substitute Fonts options from the
last dialog box.
xiv
This icon to the left of bold italicized text denotes a note, which alerts you
to important information.
This icon to the left of bold italicized text denotes a caution, which advises
you of precautions to take to avoid injury, data loss, or a system crash.
bold
Bold text denotes the names of menus, menu items, parameters, or dialog
box buttons.
bold italic
italic
monospace
Text in this font denotes text or characters that you should literally enter
from the keyboard, sections of code, programming examples, and syntax
examples. This font is also used for the proper names of disk drives, paths,
directories, programs, functions, filenames and extensions, and for
statements and comments taken from programs.
monospace bold
Bold text in this font denotes the messages and responses that the computer
automatically prints to the screen.
monospace italic
Italic text in this font denotes that you must enter the appropriate words or
values in the place of these items.
paths
Paths in this manual are denoted using backslashes (\) to separate drive
names, directories, folders, and files.
Related Documentation
You may find the following documentation helpful while programming in
LabWindows/CVI:
xv
Customer Communication
National Instruments wants to receive your comments on our products and
manuals. We are interested in the applications you develop with our
products, and we want to help you if you have problems with them. To
make it easy for you to contact us, this manual contains comment and
technical support forms for you to complete. These forms are in
Appendix B, Customer Communication, at the end of this manual.
xvi
LabWindows/CVI Compiler
Overview
The LabWindows/CVI compiler is a 32-bit ANSI C compiler. The kernel of the
LabWindows/CVI compiler is the lcc ANSI C compiler ( Copyright 1990, 1991, 1992, 1993
David R. Hanson). It is not an optimizing compiler, but instead focuses on debugging, user
protection, and platform independence. Because the compiler is an integral part of the
LabWindows/CVI environment and features a limited set of straightforward options, it is also
easy to use.
Compiler Limits
Table 1-1 shows the compiler limits for LabWindows/CVI.
Table 1-1. LabWindows/CVI Compiler Limits
Coding Attribute
Limit
32
16
32
64
32
1-1
31
Chapter 1
LabWindows/CVI Compiler
Compiler Options
You can set the LabWindows/CVI compiler options by selecting OptionsCompiler Options
in the Project window. This command opens a dialog box that allows you to set
LabWindows/CVI compiler options. For a discussion of these options, refer to the Compiler
Options section in Chapter 3, Project Window, of the LabWindows/CVI User Manual.
Compiler Defines
The LabWindows/CVI compiler accepts compiler defines through the Compiler Defines
command in the Options menu of the Project window. For more information, refer to the
Compiler Defines section in Chapter 3, Project Window, of the LabWindows/CVI User
Manual.
C Language Non-Conformance
LabWindows/CVI for UNIX does not allow you to pass a struct as one of a series of
unspecified variable arguments. Because of this, va_arg (ap, type) is not legal in
LabWindows/CVI if type is a struct type.
LabWindows/CVI accepts the #line preprocessor directive, but ignores it.
C Language Extensions
The LabWindows/CVI compiler has several extensions to the C language. The purpose is to
make the LabWindows/CVI compiler compatible with the commonly used C extensions in
external compilers under Windows 95/NT.
In Microsoft Visual C/C++, Borland C/C++, and Symantec C/C++, the calling convention
normally defaults to __cdecl if you do not use a calling convention qualifier. You can,
1-2
Chapter 1
LabWindows/CVI Compiler
however, set options to cause the calling convention to default to __stdcall. The behavior
is the same in LabWindows/CVI. You can set the default calling convention to either __cdecl
or __stdcall using the Compiler Options command in the Options menu of the Project
window. When you create a new project, the default calling convention is __cdecl.
In Watcom C/C++, the default calling convention is not __cdecl or __stdcall. You must
use the -4s (80486 Stack-Based Calling) option when you compile a module in Watcom for
use in LabWindows/CVI. Refer to the Compatibility with External Compilers section in
Chapter 3, Windows 95/NT Compiler/Linker Issues. The -4s option causes the stack-based
calling convention to be the default. In LabWindows/CVI under Watcom compatibility mode,
the default calling convention is always the stack-based convention. It cannot be changed. The
LabWindows/CVI compiler accepts the __cdecl and __stdcall conventions under
Watcom, except that floating point and structure return values do not work in the __cdecl
calling convention. National Instruments recommends that you avoid using __cdecl with
Watcom.
In the __cdecl calling convention and the Watcom stack-based calling convention, the
calling function is responsible for cleaning up the stack. Functions can have a variable number
of arguments.
In the __stdcall calling convention, the called function is responsible for cleaning up the
stack. Functions with a variable number of arguments do not work in __stdcall. If you use
the __stdcall qualifier on a function with a variable number of arguments,
LabWindows/CVI does not honor the qualifier. All compilers pass parameters and return
values in the same way for __stdcall functions, except for floating point and structure
return values.
National Instruments recommends the __stdcall calling convention for all functions
exported from a DLL, except functions with a variable number of arguments. Visual Basic
and other non-C Windows programs expect DLL functions to be __stdcall.
1-3
Chapter 1
LabWindows/CVI Compiler
At this time, not all these qualifiers work in all external compilers. The LabWindows/CVI
cvidef.h include file defines the following macros, which are designed to work in each
external compiler.
DLLIMPORT
DLLEXPORT
An import qualifier informs the compiler that the symbol is defined in a DLL. Declarations
of variables imported from a DLL require import qualifiers, but function declarations do not.
An export qualifier is relevant only in a project for which the target type is Dynamic Link
Library. The qualifier can be on the declaration or definition of the symbol, or both. The
qualifier instructs the linker to include the symbol in the DLL import library.
Duplicate Typedefs
The LabWindows/CVI compiler does not report an error on multiple definitions of the same
typedef identifier, as long as the definitions are identical.
If the maximum alignment is 1, the compiler can start the structure on any 1-byte boundary
and inserts no gaps between the structure elements.
If the maximum alignment is 8, the compiler must start the structure on an 8-byte boundary,
place shortVal on a 2-byte boundary, and place d2 on an 8-byte boundary.
1-4
Chapter 1
LabWindows/CVI Compiler
The maximum alignment the compiler applies to a structure is based on the last pack
pragma statement it sees before the definition of the structure.
C Library Issues
This section discusses special considerations in LabWindows/CVI in the areas of low-level
I/O functions and the UNIX C library.
1-5
Chapter 1
LabWindows/CVI Compiler
Data Types
Table 1-2 shows the LabWindows/CVI allowable data types.
Table 1-2. LabWindows/CVI Allowable Data Types
Type
Size
Minimum
Maximum
char
128
127
unsigned char
255
short
16
32,768
32,767
unsigned short
16
65,535
32
unsigned int
32
2 1
unsigned long
32
2 1
float
32
3.40282E+38
3.40282E+38
64
1.79769E+308
1.79769E+308
pointers (void *)
32
N/A
N/A
enum
8, 16, or 32
31
31
2 1
32
32
31
31
2 1
The size of an enumeration type depends on the value of its enumeration constant.
In LabWindows/CVI, characters are signed, unless you explicitly declare them unsigned.
The types float and double conform to 4-byte and 8-byte IEEE standard formats.
1-6
Chapter 1
LabWindows/CVI Compiler
declares a 2-byte integer in a 16-bit compiler such as LabWindows for DOS. In contrast,
a 32-bit compiler such as LabWindows/CVI handles this code as a declaration of a 4-byte
integer. In most cases, this does not cause a problem and the conversion is transparent,
because functions that use 2-byte integers in LabWindows for DOS use 4-byte integers in
LabWindows/CVI. However, this conversion does cause a problem when a program performs
one of the following actions:
Passes an array of 16-bit integers to a GPIB, VXI, or Data Acquisition (DAQ) function
If you use a 32-bit int array to receive a set of 16-bit integers from a device,
LabWindows/CVI packs two 16-bit values into each element of the 32-bit array. Any
attempt to access the array on an element-by-element basis does not work. Declare the
array as short instead, and make sure any type specifiers that refer to it have the [b2]
modifier when you pass them as an argument to a Formatting and I/O Library function.
Note
The default for %d is 2 bytes on a 16-bit compiler and 4 bytes on a 32-bit compiler.
In the same way, the default for int is 2 bytes on a 16-bit compiler, and 4 bytes on
a 32-bit compiler. This is why you do not have to make any modifications if the
specifier for a variable of type int is %d without the bn modifier.
All pointers are 32-bit offsets. LabWindows/CVI does not use the far pointers that have both
a segment selector and an offset, except in 16-bit Windows DLLs under Windows 3.1.
LabWindows/CVI for Windows 3.1 calls 16-bit DLLs through a special interface
LabWindows/CVI generates from the header file for the DLL. For more information, refer to
the Using 32-Bit Watcom Compiled Modules under Windows 3.1 and 16-Bit Windows DLLs
sections in Chapter 4, Windows 3.1 Compiler/Linker Issues.
1-7
Chapter 1
LabWindows/CVI Compiler
Debugging Levels
You can compile the source modules in your application to include debugging information. If
you do so, you can use breakpoints and view or modify variables and expressions while your
program is suspended. You set the debugging level by selecting OptionsRun Options in the
Project window. Refer to the Run Options section in Chapter 3, Project Window, of the
LabWindows/CVI User Manual for information on debugging levels.
User Protection
User protection detects invalid program behavior that LabWindows/CVI cannot otherwise
detect during compilation. LabWindows/CVI reports such invalid program behavior as user
protection errors. When you set the debugging level to Standard or Extended,
LabWindows/CVI maintains extra information for arrays, structures, and pointers, and uses
the information at run time to determine the validity of addresses.
Two groups of user protection errors exist based upon two characteristics: severity level and
error category. In each case, the ANSI C standard states that programs with these errors have
undefined behavior. The two severity levels are as follows:
Non-Fatal errors include expressions that are likely to cause problems, but do not
directly affect program execution. Examples include bad pointer arithmetic, attempts to
free pointers more than once, and comparisons of pointers to different array objects. The
expression is invalid and its behavior is undefined, but execution can continue.
Fatal errors include expressions that LabWindows/CVI cannot execute without causing
major problems, such as causing a general protection fault. For example, dereferencing
an invalid pointer value is a fatal error.
Error categories include pointer protection, dynamic memory protection, library protection,
and general protection errors. Each of these categories includes subgroups as described in the
following sections.
1-8
Chapter 1
LabWindows/CVI Compiler
invalid or when the arithmetic operation results in an invalid pointer expression. The
following user protection errors involve pointer arithmetic:
Dereference of out-of-bounds pointer (dereference using a pointer value before the start,
or past the end, of an array)
1-9
Chapter 1
LabWindows/CVI Compiler
Dereference of a pointer to an n-byte type where less than n bytes exist in the object
1-10
Chapter 1
LabWindows/CVI Compiler
The missing return value error means that a non-void function (one you do not declare with
void return type) returned, but did not returned a value.
1-11
Chapter 1
LabWindows/CVI Compiler
LabWindows/CVI library functions return error codes in a variety of cases. If you enable the
Break on Library Errors option in the Run Options command in the Options menu of the
Project window, LabWindows/CVI suspends execution after a library function returns one of
these errors. A message appears that displays the name of the function and either the return
value or a string that explains why the function failed.
1-12
Chapter 1
LabWindows/CVI Compiler
This macro could be useful in the following situation: LabWindows/CVI reports erroneous
run-time errors because you set a pointer to dynamic memory in a source module and you then
resize it in an object module. The following steps describe how this error occurs:
1.
You declare a pointer in a source module you compile with debugging enabled. You then
assign to the pointer an address that malloc or calloc returns:
AnyType *ptr;
ptr = malloc(N);
2.
You reallocate the pointer in an object module so that it points to the same location in
memory as before. This might occur if you call the realloc function or free the pointer
and then reassign it to memory that you allocate with malloc:
ptr = realloc(ptr, M); /* M > N */
or
free(ptr);
ptr = malloc(M);
3.
You use the same pointer in a source module you compile with debugging enabled. At
this point, LabWindows/CVI still expects the pointer to point to a block of memory of
the original size (N).
*(ptr+(M-1))
To prevent this error, use the DISABLE_RUNTIME_CHECKING macro to disable checking for
the pointer after you allocate memory for it in the source module:
ptr = malloc(N);
DISABLE_RUNTIME_CHECKING(ptr);
The following pragmas enable and disable library checking for a particular function. You
must declare the function before the occurrence of the pragma.
#pragma EnableFunctionRuntimeChecking function
#pragma DisableFunctionRuntimeChecking function
1-13
Chapter 1
LabWindows/CVI Compiler
These two pragmas enable and disable run-time checking for a particular library function
throughout the module in which they appear. You can use them to override the effects of the
EnableLibraryRuntimeChecking and DisableLibraryRuntimeChecking pragmas
for individual functions. If both of these pragmas occur in a module for the same function,
LabWindows/CVI uses only the last occurrence.
Note
Note
You cannot use pragmas to disable protection for the functions in the
statically linked libraries including User Interface, RS-232, TCP, DDE,
Formatting and I/O, Utility, X Property, and ANSI C libraries unless you place the
DisableLibraryRuntimeChecking pragma at the top of the library header file.
Note
An exception exists. Casts that you apply implicitly or explicitly to the void *
values you obtain from malloc or calloc do not disable user protection.
Casting a pointer to one arithmetic type to a pointer to a different one, such as (int *),
(unsigned *), (short *), and so on, does not affect run-time checking on the resulting
pointer, nor does casting a pointer to a void pointer (void *).
1-14
Chapter 1
LabWindows/CVI Compiler
Dynamic Memory
LabWindows/CVI provides run-time error checking for pointers and arrays in dynamically
allocated memory.
You can use the ANSI C library functions malloc or calloc to allocate dynamic memory.
These functions return void * values that you must cast to some other type before the
memory can be used. During program execution, LabWindows/CVI uses the first such cast
on the return value of each call to these functions to determine the type of the object that will
be stored in the dynamic memory. Subsequent casts to different types can disable checking on
the dynamic data, as explained in the Pointer Casting discussion in this section.
You can use the realloc function to resize dynamically allocated memory. This function
increases or decreases the size of the object associated with the dynamic memory.
LabWindows/CVI adjusts the user protection information accordingly.
This call passes the return value from malloc to MyFunc but does not assign it to a variable.
If you make this call repeatedly in your program with run-time checking enabled, you lose a
small amount of memory each time.
Change the code as follows to avoid this problem.
void *p;
MyFunc (1, 2, p = malloc(7));
The following code also works and uses better programming style.
void *p;
p = malloc(7);
MyFunc (1, 2, p);
1-15
Chapter 1
LabWindows/CVI Compiler
Library Functions
The LabWindows/CVI library functions that take pointer arguments or that return pointers
incorporate run-time checking for those arguments and return values. However, you must be
careful when passing arguments to library functions that have void * parameters, such as
GetCtrlAttribute and GetCtrlVal in the User Interface Library and memcpy and
memset in the ANSI C library. If you use a void * cast when you pass an argument to a
function that expects a variably typed argument, you disable run-time checking for that
argument. Some examples follow:
{
int value;
GetCtrlVal(panel, ctrl, &value);
/* CORRECT
*/
GetCtrlVal(panel, ctrl, (void *)&value);/* INCORRECT */
}
{
char *names[N], *namesCopy[N];
memcpy(namesCopy, names, sizeof (names));/* CORRECT
*/
memcpy((void *)namesCopy, (void *)names, sizeof names);
/* INCORRECT */
}
Unions
LabWindows/CVI performs only minimal checks for union type variables. If a union
contains pointers, arrays, or structs, LabWindows/CVI does not maintain user protection
information for those objects.
Stack Size
Your program uses the stack for passing function parameters and storing automatic local
variables. You can set the maximum stack size by selecting the OptionsRun Options in the
Project window. Table 1-3 shows the stack size ranges LabWindows/CVI supports.
Table 1-3. Stack Size Ranges for LabWindows/CVI
Platform
Default
Maximum
4 KB
40 KB
40 KB
Windows 95/NT
100 KB
250 KB
1 MB
100 KB
250 KB
5 MB
100 KB
250 KB
5 MB
Windows 3.1
Minimum
1-16
Chapter 1
Note
LabWindows/CVI Compiler
For LabWindows/CVI for Windows 3.1, the actual stack size approaches 64 KB
when you set the Debugging level to None.
Include Paths
The Include Paths command in the Options menu of the Project window specifies the
directory search path for include files. The Include Paths dialog box has two lists, one for
include paths specific to the project, and one for paths not specific to the project.
When you install VXIplug&play instrument drivers, the installation program places the
include files for the drivers in a specific VXIplug&play include directory. LabWindows/CVI
also searches that directory for include files.
Project list
2.
3.
4.
5.
6.
7.
8.
9.
1-17
Using Loadable
Compiled Modules
This chapter describes the advantages and disadvantages of using compiled code modules in
your application. It also describes the kinds of compiled modules available in
LabWindows/CVI and includes programming guidelines for modules you generate with
external compilers.
Refer to Chapter 3, Windows 95/NT Compiler/Linker Issues, Chapter 4, Windows 3.1
Compiler/Linker Issues, or Chapter 5, UNIX Compiler/Linker Issues, in this manual for more
information on platform-specific programming guidelines for modules that external
compilers generate.
A .obj file on the PC, or a .o file under UNIX, that contains one object module
A .lib file on the PC, or a .a file under UNIX, that contains one or more object modules
You can create any of these compiled modules in LabWindows/CVI under Windows 95/NT,
or using a compatible external compiler. Under Windows 3.1, LabWindows/CVI can create
only .obj files. Under UNIX, LabWindows/CVI can create only .o files.
2-1
Chapter 2
Compiled modules run faster than source modules. Compiled modules do not contain the
debugging and user protection code LabWindows/CVI generates when it compiles
source modules. Compiled modules you generate in external compilers can run faster
because of optimization.
LabWindows/CVI recompiles the source modules in a project each time you open the
project. Also, if an instrument driver program file is a source module, LabWindows/CVI
recompiles it each time you load the instrument driver. LabWindows/CVI does not
recompile compiled modules when you open a project or load an instrument driver.
In standalone executables, you can dynamically load compiled modules but not source
modules.
You can install compiled modules, but not source modules, into the Library menu.
You can provide libraries for other developers without giving them access to your source
code.
You cannot debug compiled modules. Because compiled modules do not contain any
debugging information, you cannot set breakpoints or view variable values.
2-2
Chapter 2
If the instrument driver program file is a compiled module, it must adhere to the requirements
outlined for each operating system in Chapter 3, Windows 95/NT Compiler/Linker Issues,
Chapter 4, Windows 3.1 Compiler/Linker Issues, and Chapter 5, UNIX Compiler/Linker
Issues, of this manual.
To use a DLL in your project under Windows 95/NT, you must include the DLL
import library (.lib) file in the project list rather than the DLL.
Even when you include a source module in the project list, you can instruct LabWindows/CVI
to create an object module on disk when it compiles the file instead of debuggable code in
memory. To do this, double click in the O column next to the source file in the Project window.
2-3
Chapter 2
Compiled modules must adhere to the requirements outlined for the target operating
system. Chapter 3, Windows 95/NT Compiler/Linker Issues, Chapter 4, Windows 3.1
Compiler/Linker Issues, and Chapter 5, UNIX Compiler/Linker Issues, of this manual, discuss
operating system requirements.
2-4
Chapter 2
kRunState_EnableCallbacks,
kRunState_DisableCallbacks
};
Example 1
kRunState_Start
kRunState_EnableCallbacks
/* user program execution begins */
.
.
.
/* a breakpoint or run-time error occurs, or user presses the
Terminate Execution key combination */
kRunState_DisableCallbacks
kRunState_Suspend
/* program execution suspends; CVI environment resumes */
.
.
.
/* user requests the execution be resumed, through the "Continue",
"Step Over", etc., commands */
kRunState_Resume
kRunState_EnableCallbacks
/* user program execution resumes */
.
.
.
/* user program execution completes normally */
kRunState_DisableCallbacks
kRunState_Stop
2-5
Chapter 2
Example 2
kRunState_Start
kRunState_EnableCallbacks
/* user program execution begins */
.
.
.
/* a breakpoint or run-time error occurs, or user presses the
Terminate Execution key combination */
kRunState_DisableCallbacks
kRunState_Suspend
/* program execution suspends; CVI environment resumes */
.
.
.
/* user selects the Terminate Execution command */
kRunState_DisableCallbacks /* even though callbacks already
disabled */
kRunState_AbortingExecution
/* long jump out of user program */
kRunState_DisableCallbacks /* even though callbacks already
disabled */
kRunState_Stop
Note
Note
Run state change callbacks do not work if you link your program in an external
compiler. Also, external compilers report link errors if you have multiple run state
change callbacks.
Use caution when you call into other DLLs in response to a kRunState_Stop message.
When you use your DLL in a standalone executable, the DLL receives the
kRunState_Stop message when the executable terminates. The order in which
2-6
Chapter 2
Windows 95/NT unloads DLLs at process termination is not well-defined. Therefore, the
DLL you call into might no longer be loaded. This can cause a general protection fault.
Nevertheless, when you use your DLL in a program in the LabWindows/CVI
development environment, it is often necessary to call into DLLs to release resources
after each run. To solve this dilemma, use conditional code to release resources only if
you are running in the LabWindows/CVI development environment. An example
follows.
#include <utility.h>
switch (runState)
{
case kRunState_Stop:
if (! InStandaloneExecutable())
{ /* call into other DLLs to release resources */ }
/* release resources, including unloading DLLs */
break;
}
It is always safe to call into the LabWindows/CVI Run-time Engine in a run state change
callback.
If your DLL uses global variables that can become stale after each program execution in
the LabWindows/CVI development environment, re-initialize the variables in response
to the kRunState_Start or kRunState_Stop message. For example, memory that
you allocate using LabWindows/CVI ANSI C functions such as malloc or calloc is no
longer valid when you restart your program. If your DLL has global variables that point
to allocated memory, set those pointers to NULL in response to the kRunState_Start
or kRunState_Stop message.
2-7
Windows 95/NT
Compiler/Linker Issues
This chapter describes the different kinds of compiled modules available under
LabWindows/CVI for Windows 95/NT and includes programming guidelines
for modules you generate with external compilers.
Under Windows 95/NT, the LabWindows/CVI compiler is compatible with four external
32-bit compilers: Microsoft Visual C/C++, Borland C/C++, Watcom C/C++, and
Symantec C/C++. This manual refers to the four compilers as the compatible external
compilers.
In LabWindows/CVI under Windows 95/NT, you can do the following:
Call the LabWindows/CVI libraries from executables or DLLs created with any of the
four compatible external compilers
Create object files, library files, and DLL import libraries that the compatible external
compilers can use
Load object files, library files, and DLL import libraries created with any of the four
compatible external compilers
3-1
Chapter 3
3-2
Chapter 3
callback in a DLL, you must take special care. Refer to the Notification of Changes in Run
State section in Chapter 2, Using Loadable Compiled Modules, of this manual, for a detailed
discussion of run state change callbacks.
DllMain
Each DLL can have a DllMain function, except that the Borland compiler uses
DllEntryPoint as the name. The operating system calls the DllMain function with various
messages. To generate the template for a DllMain function, use the Insert Constructs
command in the Edit menu of a Source window.
Use caution when inserting code in the PROCESS_ATTACH and PROCESS_DETACH cases. In
particular, avoid calling into other DLLs in these two cases. The order in which
Windows 95/NT initializes DLLs at startup and unloads them at process termination is not
well-defined. Thus, the DLLs you want to call might not be in memory when your DllMain
receives the PROCESS_ATTACH or PROCESS_DETACH message.
It is always safe to call into the LabWindows/CVI Run-time Engine in a run state change
callback, as long as you do so before calling CloseCVIRTE.
3-3
Chapter 3
Note
cvirte.dll contains the User Interface, Utility, Formatting and I/O, RS-232,
ANSI C, TCP, and DDE Libraries.
3-4
Chapter 3
3-5
Chapter 3
Structure Packing
The compilers differ in their default maximum alignment of elements within structures.
If your DLL API uses structures, you can guarantee compatibility among the different
compilers by using the pack pragma to specify a specific maximum alignment factor. Place
this pragma in the DLL include file, before the definitions of the structures. You can choose
any alignment factor. After the structure definitions, reset the maximum alignment factor back
to the default, as in the following example:
#pragma pack (4)
typedef struct {
char a;
int b;
} MyStruct1;
typdef struct {
char a;
double b;
} MyStruct2;
#pragma pack ()
Bit Fields
Borland C/C++ uses the smallest number of bytes necessary to hold the bit fields you specify
in a structure. The other compilers always use 4-byte elements. You can force compatibility
by adding a dummy bit field of the correct size to pad the set of contiguous bit fields so that
they fit exactly into a 4-byte element. Example:
typedef struct {
int a:1;
int b:1;
int c:1;
int dummy:29;
} MyStruct;
/* pad to 32 bits */
3-6
Chapter 3
Returning Structures
For functions you do not declare with the __stdcall calling convention, the compilers
return structures using different mechanisms. For functions you declare with __stdcall, the
compilers return structures in the same way, except for 8-byte structures. National
Instruments recommends that your DLL API use structure output parameters instead of
structure return values.
Enum Sizes
By default, Watcom uses the smallest integer size necessary to represent the largest enum
value: 1 byte, 2 bytes, or 4 bytes. The other compilers always use 4 bytes. Force compatibility
by using the -ei (Force Enums to Type Int) option with the Watcom compiler.
Long Doubles
In Borland C/C++, long double values are 10 bytes. In the other compilers, they are 8 bytes.
In LabWindows/CVI, they are always 8 bytes. Avoid using long double in your DLL API.
long double values are 10 bytes in Borland C/C++ but 8 bytes in LabWindows/CVI.
You cannot use the Watcom C/C++ __cdecl calling convention in LabWindows/CVI for
functions that return float or double scalar values or structures. In Watcom, __cdecl
is not the default calling convention.
3-7
Chapter 3
When you call the LabWindows/CVI Libraries from a multithreaded executable you
create in LabWindows/CVI or in an external compiler.
When you call the LabWindows/CVI Libraries from a DLL that a multithreaded
executable loads. You can create the DLL in LabWindows/CVI or in an external
compiler.
When you call the LabWindows/CVI Libraries from an object or static library file that
you dynamically load in a multithreaded executable. You can create the object or library
file in LabWindows/CVI or in an external compiler.
All the LabWindows/CVI libraries are multithreaded safe when used outside of the
LabWindows/CVI development environment.
For detailed information on how to use the LabWindows/CVI User Interface Library in a
multithreaded program, refer to Chapter 3, Programming with the User Interface Library, in
the LabWindows/CVI User Interface Reference Manual.
3-8
Chapter 3
/* startup library */
/* import library to DLL containing:*/
/*
User Interface Library
*/
/*
Formatting and I/O Library
*/
/*
RS-232 Library
*/
/*
DDE Library
*/
/*
TCP Library
*/
/*
Utility Library
*/
You can add the following static library file from cvi\extlib to your external compiler
project:
analysis.lib /* Analysis or Advanced Analysis Library */
You can add the following DLL import library files from cvi\extlib to your external
compiler project:
gpib.lib
dataacq.lib
easyio.lib
visa.lib
nivxi.lib
ivi.lib
cviauto.lib
/*
/*
/*
/*
/*
/*
/*
If you use an instrument driver that makes references to both the GPIB and VXI libraries, you
can include both gpib.lib and nivxi.lib to resolve the references to symbols in those
libraries. If you do not have access to one of these files, you can replace it with one of
following files:
gpibstub.obj /* stub GPIB functions
vxistub.obj /* stub VXI functions
3-9
*/
*/
Chapter 3
If you use an external compiler that requires a WinMain entry point, the following optional
library allows you to define only main in your program.
cviwmain.lib
Include Files for the ANSI C Library and the LabWindows/CVI Libraries
The cvirt.lib import library contains symbols for all the LabWindows/CVI libraries,
except the ANSI C standard library. When you create an executable or DLL in an external
compiler, you use the compilers own ANSI C standard library. Because of this, you must use
the external compilers include files for the ANSI C library when compiling source files.
Although the include files for the other LabWindows/CVI libraries are in the cvi\include
directory, the LabWindows/CVI ANSI C include files are in the cvi\include\ansi
directory. Thus, you can specify cvi\include as an include path in your external compiler
while at the same time using the external compilers version of the ANSI C include files.
Note
Use the external compilers ANSI C include files only when you compile a source
file that you intend to link using the external compiler. If you intend to link the file
in LabWindows/CVI, use the LabWindows/CVI ANSI C include files. This is true
regardless of which compiler you use to compile the source file.
For more information, refer to the Setting Up Include Paths for LabWindows/CVI, ANSI C,
and SDK Libraries section later in this chapter.
3-10
Chapter 3
When you link your program in an external compiler, the external compiler does not make
such a table available to the User Interface Library. To resolve callback references, you must
use LabWindows/CVI to generate an object file that contains the necessary table.
1.
Create a LabWindows/CVI project that contains the .uir files your program uses, if you
do not already have one.
2.
Select the External Compiler Support command in the Build menu of the Project
window. A dialog box appears.
3.
In the UIR Callbacks Object File control, enter the pathname of the object file you want
to generate. When you click on the Create button, LabWindows/CVI generates the
object file with a table that contains the names of all the callback functions referenced in
all the .uir files in the project. When you modify and save any of these .uir files,
LabWindows/CVI regenerates the object file to reflect the changes.
4.
Include this object file in the external compiler project you use to create the executable.
5.
You must call InitCVIRTE at the beginning of your main or WinMain function. Refer
to the Calling InitCVIRTE and CloseCVIRTE section later in this chapter.
Create a LabWindows/CVI project that contains the .uir files your DLL loads, if you
do not already have one.
2.
Select the External Compiler Support command in the Build menu of the Project
window. A dialog box appears.
3.
In the UIR Callbacks Object File control, enter the pathname of the object file you want
to generate. When you click on the Create button, LabWindows/CVI generates the
object file with a table that contains the names of all the callback functions referenced in
all the .uir files in the project. When you modify and save any of these .uir files,
LabWindows/CVI regenerates the object file to reflect the changes.
3-11
Chapter 3
4.
Include this object file in the external compiler project you use to create the DLL.
5.
You must call InitCVIRTE and CloseCVIRTE in your DLLMain function. Refer to the
Calling InitCVIRTE and CloseCVIRTE section later in this chapter.
This section does not apply unless you use LoadExternalModule to load object
or static library files.
Unlike DLLs, object and static library files can contain unresolved references. If you call
LoadExternalModule to load an object or static library file at run time, the Utility
Library must resolve those references using function and variable symbols from the
LabWindows/CVI Run-time Engine, from the executable, or from previously loaded run-time
modules. A table of these symbols must be available in the executable. When you link your
program in LabWindows/CVI, LabWindows/CVI automatically includes a symbol table. This
is true whether you run your program in the LabWindows/CVI development environment or
as a standalone executable.
When you link your program in an external compiler, the external compiler does not make
such a table available to the Utility Library. LabWindows/CVI provides ways to help you
create the symbol table easily.
3-12
Chapter 3
module references any of the commonly used Windows SDK functions, you can use the
cvi\sdk\include\basicsdk.h file.
Execute the External Compiler Support command in the Build menu of the Project window.
A dialog box appears. Enable the Using Load External Module option. Enable the Other
Symbols checkbox if it is not already enabled. Enter the pathname of the include file in the
Header File control. Enter the pathname of the object file to generate in the Object File
control. Click on the Create button to the right of the Object File control.
Include the object file in the external compiler project you use to create your executable. Also,
you must call InitCVIRTE at the beginning of your main or WinMain function. Refer to the
Calling InitCVIRTE and CloseCVIRTE section later in this chapter.
3-13
Chapter 3
resources your program allocated, but your compiled module might have to do more. Also, if
the program suspends for debugging purposes, your compiled module might have to disable
interrupts.
When you run an executable created in an external compiler, it always executes as a separate
process, even when you debug it. Thus, the run state change callback facility is not necessary
and does not work. External compilers report link errors when you define
__RunStateChangeCallback in more than one object file. If you include a run state
change callback in a compiled module that you intend to use both in LabWindows/CVI and
an external compiler, it is a good idea to put the callback function in a separate source file and
create a .lib file instead of a .obj file.
*/
For an executable using WinMain as the entry point, your code must include the following
segment:
#include <cvirte.h>
int __stdcall WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
if (InitCVIRTE(hInstance, 0, 0) == 0)
return (-1);/* out of memory
*/
/* your other code */
}
3-14
Chapter 3
For a DLL, you also have to call CloseCVIRTE in DLLMain. The code must include the
following segment:
#include <cvirte.h>
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID pvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
/* your other ATTACH code */
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
/* your other DETACH code */
CloseCVIRTE ();
}
return 1;
}
Note
It is harmless, but unnecessary, to call these functions when you link your
executable in LabWindows/CVI for Windows 95/NT.
3-15
Chapter 3
default library directive, and the linker does not explicitly include a C library in the link, the
linker reports unresolved function references in the object modules.
Object and static library files that LabWindows/CVI creates do not contain a default library
directive. This has different implications for each compiler.
In the Visual C development environment, add these library names using the Input category
in the Link tab of the Project Settings dialog box.
Borland C/C++
No problems exist with the absence of default library directives when you use the Borland
compiler.
Watcom C/C++
Like Visual C, at least one object file must contain a default library directive to cause the
C library to be linked in. In addition, Watcom also requires a default library directive for
floating-point support.
If you do not include in your project any object files with the required directives, add the
following libraries, in the order shown, to the Libraries setting in the Windows Linking
Switches dialog box:
clib3s
math387
noemu387
Symantec C/C++
Each object file must have the default library directive for the C library. You must explicitly
add the Symantec C library to your project. The library filename is snn.lib and it is in the
lib subdirectory under the Symantec installation directory.
3-16
Chapter 3
3-17
Chapter 3
(Unsigned Characters)
/Zp
/Ge
(Stack Probes)
/Gh
(Profiling)
/Gs
(Stack Probes)
Borland C/C++
LabWindows/CVI is compatible with all the defaults.
You must not use the following options to override the default settings:
-a
(Data Alignment)
-K
(Unsigned Characters)
-u-
-N
-p
-pr
-fp
3-18
Chapter 3
Watcom C/C++
You must use the following options to override the default settings:
-ei
-bt=nt
-mf
-4s
-s
-j
-fpi87
You must not use the following option to override the default settings:
(Structure Alignment)
-Zp
Symantec C/C++
You must use the following options to override the default settings:
-mn
-f
You must not use the following options to override the default settings:
-a
(Struct Alignment)
-P
-s
Note
Certain specialized options can generate symbol references that cause link errors
in LabWindows/CVI. If you encounter a link error on a symbol in a module you
compiled in an external compiler and you do not recognize the symbol, try
changing your external compiler options.
3-19
Chapter 3
3-20
Chapter 3
To customize an import library, you must have an include file that contains the declarations
of all the functions you want to export from the DLL. Load the include file into a Source
window, and execute the Generate DLL Import Source command in the Options menu.
After you have generated the import source, you can modify it, including making calls to
functions in other source files. Create a new project that contains the import source file and
any other files it refers to. Select Static Library from the submenu attached to the Target
command in the Build menu of the Project window. Execute the Create Static Library
command.
Note
This import source code does not operate in the same way as a normal DLL import
library. When you link a normal DLL import library into an executable, the
operating system attempts to load the DLL as soon as the program starts. The
import source code LabWindows/CVI generates does not load the DLL until you
call one of the functions it exports.
The calling convention you use to declare the functions you want to export
How you specify which DLL functions and variables you want to export
This section discusses how you can address these issues when you create your DLL in
LabWindows/CVI. If you create your DLL in an external compiler, the approach is very
similar. The external compilers, however, do not agree in all aspects. This chapter also
discusses these differences.
Some of the information in this section is very technical and complex. Recommendations on
the best approaches to these issues are at the end of the section. These recommendations are
intended to make creating the DLL as simple as possible, and to make it easy to use the same
source code in LabWindows/CVI and the external compilers.
3-21
Chapter 3
project. You must use the __stdcall keyword in the declarations in the include file you
distribute with the DLL.
Other platforms, such as UNIX or Windows 3.1 do not recognize the __stdcall keyword.
If you work with source code that you might use on other platforms, you must use a macro in
place of __stdcall. The cvidef.h include file defines the DLLSTDCALL macro for this
purpose.
The following are examples of using the DLLSTDCALL macro.
int DLLSTDCALL MyIntFunc (void);
char * DLLSTDCALL MyStringFunc (void);
Note
You cannot use the __stdcall calling convention on functions with a variable
number of arguments. Consequently, you cannot use such functions in Microsoft
Visual Basic.
3-22
Chapter 3
macro to resolve differences among compilers and platforms. The following are examples of
using the DLLEXPORT macro:
int DLLEXPORT DLLSTDCALL MyFunc (int parm) {}
int DLLEXPORT myVar = 0;
If the type of your variable or function requires an asterisk (*) in the syntax, put the qualifier
after the asterisk, as in the following example:
char * DLLEXPORT myVar = NULL;
Note
Borland C/C++ version 4.5x, requires that you place the qualifier before the
asterisk. In Borland C/C++ 5.0, you can place the qualifier on either side of the
asterisk.
When LabWindows/CVI creates a DLL, it exports all symbols for which export qualifiers
appear in either the definition or the declaration. If you use an export qualifier on the
definition and an import qualifier on the declaration, LabWindows/CVI exports the symbol.
The external compilers differ widely in their behavior on this point. Some require that the
declaration and definition agree.
Note
If you include in your DLL project an object or library file that defines exported
symbols, LabWindows/CVI cannot correctly create import libraries for each of the
external compilers. This problem does not arise if you use only source code files
in your DLL project.
If you mark variable declarations in the include file with import qualifiers and you use
the include file in a source file other than the one in which you define the variable,
LabWindows/CVI and the external compilers treat the variable as if it were imported
from another DLL and generate incorrect code as a result.
If you use export qualifiers in the definition of symbols and the include file contains
import qualifiers on the same symbols, some external compilers report an error.
3-23
Chapter 3
You can avoid exporting variables from DLLs, and thereby eliminate the need to use
import qualifiers. For each variable you want to export, you can create functions to
get and set its value or a function to return a pointer to the variable. You do not have
to use import qualifiers for functions. This is the simplest approach and works in
LabWindows/CVI. However, it does not work if you use an export qualifier in a
function definition and you create the DLL with an external compiler that requires
the declaration to use the same qualifier.
You can create a separate include file for distribution with the DLL.
You can use a special macro that resolves to either an import or export qualifier
depending on a conditional compilation flag. In LabWindows/CVI you can set the flag
in your DLL project by using the Compiler Defines command in the Options menu of
the Project window.
Recommendations
To make creating a DLL as simple as possible, adhere to the following recommendations:
Use the DLLSTDCALL macro in the declaration and definition of all functions you want
to export. Do not export functions with a variable number of arguments.
Identify the symbols you want to export using the include file method. Do not use export
qualifiers. If you use an external compiler, use the .def file method.
Do not export variables from the DLL. For each variable you want to export, create
functions to get and set its value or a function to return a pointer to the variable. Do not
use import qualifiers in the include file.
You can distribute with your DLL the same include file that you include in the source files
you use to make the DLL. This is especially useful when you create DLLs from
instrument drivers.
You can use the same source code to create the DLL in LabWindows/CVI and any of the
four compatible external compilers.
You can use your DLL in Microsoft Visual Basic or other non-C environments.
3-24
Chapter 3
If your function panel file contains help text, you can generate a Windows help file from it
using the Generate Windows Help command in the Options menu of the Function Tree
Editor window. The Create Dynamic Link Library command provides an option to include
links into the Window help file in the Type Library. These links allow Visual Basic users to
access the help information from the Type Library Browser.
Visual Basic has a more restricted set of types than C. Also, the Create Dynamic Link
Library command imposes certain requirements on the declaration of the DLL API. Use the
following guidelines to ensure that Visual Basic can use your DLL:
Do not use structures that require forward references or that contain pointers.
If you include a .lib file in a static library project, LabWindows/CVI includes all
object modules from the .lib in the static library it creates. When you create an
executable or DLL, LabWindows/CVI uses only the necessary modules from the
.lib file.
Note
Do not set the default calling convention to __stdcall if you want to create a
static library for all four compatible external compilers.
3-25
Chapter 3
Include a source (.c) file in your project. Enable the Compile into Object option for the
source file by double-clicking in the space next to the filename in the Project window
under the column marked O. Compile the file.
Open a source (.c) file and select the Create Object File command in the Options menu
of the Source window.
In LabWindows/CVI for Windows 95/NT, you can choose to create an object file for only the
currently selected compiler or to create object files for all four compatible external compilers.
Note
Do not set the default calling convention to __stdcall if you want to create a
static object for all four compatible external compilers.
3-26
Chapter 3
include files. For more information, refer to the Setting Up Include Paths for
LabWindows/CVI, ANSI C, and SDK Libraries section later in this chapter.
The number of SDK include files is very large. Normally, you have to include only
windows.h because it includes many, but not all, of the other include files. The inclusion of
windows.h along with its subsidiary include files significantly increases compilation time
and memory usage. WIN32_LEAN_AND_MEAN is a macro from Microsoft that speeds
compiling by eliminating the less commonly used portions of windows.h and its subsidiary
include files. By default, LabWindows/CVI adds /DWIN32_LEAN_AND_MEAN as a
compile-time definition when you create a new project. You can alter this setting by using the
Compiler Defines command in the Options menu of the Project window.
LabWindows/CVI for Windows 95/NT automatically loads these three libraries when it starts
up and searches them to resolve references at link time. Thus, you do not have to include these
libraries in your project.
3-27
Chapter 3
If the LabWindows/CVI linker reports SDK functions as unresolved references, you must add
import libraries to your project. Refer to the cvi\sdk\sdkfuncs.txt file for associations
of SDK import libraries to SDK functions. The import libraries are in the cvi\sdk\lib
directory.
3-28
Chapter 3
3-29
Windows 3.1
Compiler/Linker Issues
This chapter describes the different kinds of compiled modules available under
LabWindows/CVI for Windows 3.1 and includes programming guidelines for
modules you generate with external compilers.
If you make a call to the ANSI C Standard Library, you must include the
LabWindows/CVI header files instead of the Watcom header files.
You cannot call Watcom C library functions outside the scope of the ANSI C Standard
Library.
You can call open, close, read, write, lseek, or eof, but you must include
lowlvlio.h from LabWindows/CVI.
You cannot call functions in the Windows Software Development Kit (SDK), install
interrupts, perform DMA, or access hardware directly. These tasks must be done with a
Dynamic Link Library (DLL). The exception to this is that you can use the inp and outp
functions.
You cannot define a function as PASCAL, pascal, or _pascal if you intend to call it
from source code in LabWindows/CVI. Also, you cannot use any non-ANSI-C-standard
4-1
Chapter 4
keywords such as far, near, or huge in the declaration of functions to be called from
LabWindows/CVI source code.
If your Watcom-compiled module performs floating point operations, you must use
Watcom Version 9.5 or later.
Use the following options when you compile with Watcom IDE:
Set the Project Target Environment to 32-bit Windows 3.x, and set the Image Type
to Library [.lib].
Turn on the In-line with Coprocessor [fpi87] option for Floating Point Model.
Turn on the 80486 Stack-Based Calling [-4s] option for the Target Processor.
You can use optimization flags in addition to the f, and you can use other flags, such
as -wn, which do not affect the generation of object code.
Borland packs bit fields in structures differently than CVI, so you cannot share structures
with bit fields between Borland and CVI.
Borland returns structures, floats, and doubles differently than CVI. Therefore, functions
that return these types cannot be called from CVI if they are defined in Borland, or vice
versa. The exceptions are the ANSI C library functions that return doubles, which you
can call from within Borland compiled modules.
Note
This rule applies only to return values. You can use structs, floats and doubles as
output parameters without limitation.
4-2
Chapter 4
ANSI C library functions div and ldiv return structures, and hence you cannot call
them from Borland compiled modules.
The type long double is the same as double in CVI, while in Borland it is 10 bytes
long, so you cannot share objects of this type between Borland and CVI modules. This
affects the "%Le", "%Lf", "%Lg" format specifiers of printf, sprintf, fprintf,
scanf, sscanf, fscanf, and others.
Because you cannot share structures with bit fields between Borland and CVI, you cannot
use the macros in stdio.h (getc, putc, fgetc, fputc) in Borland objects.
Use the following options when you compile with Borland C 4.x:
Define _NI_mswin16_.
Set the include directories to point to cvi\include before other include directories.
If you use a file with a .c extension, Borland C++ 4.x compiles it as a C source file. If your
file has a .cpp extension, Borland C++ 4.x compiles it as a C++ source file; you must use
extern "C" for any functions or variables you want to access from a C file.
Use the following options when you compile with Symantec C++ 6.0:
Define _NI_mswin16_.
Set the include directories to point to cvi\include before any other include directories.
4-3
Chapter 4
You must observe certain rules and restrictions in a DLL you want to use with
LabWindows/CVI. If you experience problems using a DLL in LabWindows/CVI,
you might have to contact the developer of the DLL to obtain modifications.
Because LabWindows/CVI is a 32-bit application, special glue code is required to
communicate with a 16-bit DLL. For some DLLs, LabWindows/CVI can automatically
generate this glue code from the include file when loading the DLL. For other DLLs, you
have to modify the glue source code and compile it with Watcom into a .obj or .lib file.
The normal way of communicating with a DLL is by calling functions in the DLL. However,
cases exist where you must use other communication methods. The most typical case is that
of an interrupt service routine in a DLL that notifies the application when an interrupt occurs.
This is done through a callback function. Also, LabWindows/CVI can recognize messages
posted by a DLL through the Windows Application Programming Interface (API) function
PostMessage and initiate a callback function.
Enable the Check Disk Dates Before Each Run option when you iteratively modify a
DLL or DLL glue code file and run a LabWindows/CVI test program that calls into the
DLL. By enabling the Check Disk Dates Before Each Run option, you ensure that you
link the most recent version of the DLL and DLL glue code into your program. You can
leave this option enabled at all times. The only penalty is a small delay each time you
build or run the project.
By default, LabWindows/CVI does not unload and reload DLLs between each execution
of your program. This eliminates the delay in reloading the DLLs before each run. It
allows the DLLs to retain state information between each run. If, however, you use a DLL
that does not work correctly across multiple program executions, enable the Reload
DLLs Before Each Run option.
In the DLL header file, change all references to int into references to short.
In the DLL header file, change all references to unsigned or unsigned int to
unsigned short.
4-4
Chapter 4
You can use the argument types char, unsigned char, int, unsigned int, short,
unsigned short, long, unsigned long, float, and double, as well as pointers to
any type, and arrays of any type. You can use typedefs for these types.
You can use the return types void, char, unsigned char, int, unsigned int,
short, unsigned short, long, and unsigned long, as well as pointers to any type.
You can use typedefs for these types.
You can use the return types float and double only if the DLL is created with a
Microsoft C compiler, and the functions returning floats or double are declared with the
cdecl calling convention. You do not have to modify the glue code generated for
functions that return float or double values.
In the DLL header file, enum sizes must be consistent between LabWindows/CVI and the
compiler for the DLL.
typedef enum {
No_Error,
Device_Busy,
Device_Not_Found
} ErrorType;
If the DLL you are using performs DMA on a buffer you pass to it, you might experience
a problem. The DLL might attempt to lock the buffer in memory by calling the Windows
SDK function GlobalPageLock. GlobalPageLock fails on buffers allocated with the
Watcom malloc function that LabWindows/CVI uses in 32-bit mode.
Write the DLL so that if GlobalPageLock fails, the DLL attempts to lock the buffer
with the following code:
int DPMILock (void *buffer, unsigned long size)
{
DWORD base;
unsigned sel, offset;
union _REGS regs;
sel = SELECTOROF(buffer);
offset = OFFSETOF(buffer);
base = GetSelectorBase(sel);
base = base+offset;
regs.x.ax
regs.x.bx
regs.x.cx
regs.x.di
=
=
=
=
4-5
Chapter 4
regs.x.si = HIWORD(size);
int86(0x31, ®s, ®s);
return regs.x.cflag;
}
After the DMA is complete, you must unlock the buffer. You can unlock the buffer using
the DPMILock function, if you set regs.x.ax to 0x601, instead of 0x600.
If you compile the DLL with the /FPi or /FPc switches or with no /FP switches
(/FPi is the default), the DLL uses the WIN87EM.DLL floating point emulator.
LabWindows/CVI does not use WIN87EM.DLL. If the DLL uses WIN87EM.DLL, use the
following strategy in the DLL to prevent conflicts:
1.
Structure the code so that all functions that perform any floating-point math have
known entry and exit points. Ideally, specify a particular set of exported entry
points as the only ways into the floating-point code.
2.
Call the Windows SDK function FPInit in each of these entry points. Store the
previous signal handler in a function pointer.
3.
If the DLL has its own exception handler, call signal to register the DLLs own
signal handler.
4.
5.
Upon exiting through one of the well-defined DLL exit points, call the Windows
SDK function FPTerm to restore the previous exception handler and terminate
the DLLs use of WIN87EM.DLL.
4-6
Chapter 4
*/
*/
}
Note
If you use Microsoft C to build the DLL, you might get a linker error for an
undefined symbol _acrtused2. This error occurs only in Microsoft C
versions 7.00 and later. Include the following dummy function in your
DLL to fix this error. Also, when linking to the DLL, specify WIN87EM.LIB
as the first library to be linked.
void _acrtused2 (void)
{
}
The DLL requires special interface functions compiled outside of the DLL.
You pass a pointer to a function in the DLL, and the DLL uses the pointer after the
function returns. For example, you pass an array to a function that starts an asynchronous
I/O operation. The function returns immediately, but the DLL continues to operate on the
array.
You pass a function pointer to the DLL, and the DLL calls the function later. For example,
the DLL makes a direct callback into 32-bit code.
You pass to the DLL a pointer that points to other pointers. Two examples of pointers that
point to other pointers are an array of pointers and a structure pointer with pointer
members.
If your DLL falls into any of these categories, refer to the DLLs That Cannot Use Glue Code
Generated at Load Time section of this chapter for details on how to proceed. Otherwise, refer
to the DLLs That Can Use Glue Code Generated at Load Time section, also in this chapter.
4-7
Chapter 4
You can create an object module that contains the glue code. If you do so,
LabWindows/CVI can load the DLL faster because it does not have to regenerate
and recompile the glue code. To create the object module, load the .h file into a
Source window and select OptionsGenerate DLL Glue Object. If the DLL
pathname is listed in the project, replace it with the object module file. If the DLL
is not listed in the project, but is associated with a .fp file, make sure the object
module is in the same directory as the .fp file.
4-8
Chapter 4
Also, you can create a .pth file in the same directory as the .obj or .lib file with the same
base name. The .pth file must contain a simple filename or a full pathname of the DLL. If it
is a simple filename, LabWindows/CVI uses the standard Windows DLL search algorithm.
Rules for the DLL Include File Used to Generate Glue Source
You can generate the DLL glue source file by opening the .h file for the DLL in a Source
window and selecting Generate DLL Glue Source from the Options menu. This command
prompts you for the name of a .h file. It puts the glue code in a .c file with the same path and
base name as the .h file. You must modify this .c file as this section describes and compile
it using the Watcom compiler. Refer to the Using 32-Bit Watcom Compiled Modules
under Windows 3.1 section of this chapter for information on how to use the Watcom
compiler with LabWindows/CVI.
If any of the functions in the DLL are declared as PASCAL, pascal, or _pascal, you must
declare them as PASCAL in the .h file you use to generate the glue code. LabWindows/CVI
ignores the PASCAL keyword except for the purposes of generating the glue code. The stub
function in the glue code is not declared as PASCAL. If you include this .h file in the glue
code, the Watcom compiler flags as an error the inconsistency between the declaration of the
function in the .h file and the definition of the stub function. If you include it in other modules
you compile under Watcom, calls to the function erroneously compile as if the function were
PASCAL. You have two options:
Have two separate .h files, one that includes the PASCAL keyword and one that does not.
Use the one that does include the PASCAL keyword to generate the glue code only.
Use conditional compilation so that Watcom ignores the PASCAL macro when it
compiles.
Only use standard ANSI C keywords in the .h file. The keyword PASCAL is the only
exception to this rule. For example, do not use far, near, or huge.
4-9
Chapter 4
The lines of code referencing cw387 are necessary only if the DLL function
performs floating point operations. They are innocuous and execute quickly, so
LabWindows/CVI adds them to the glue code automatically. If the DLL function
does not perform floating point operations, you can remove these lines.
If realArray can be greater than 64 K, you must modify the interface routine as shown.
long WriteRealArray (double realArray[], long numElems)
{
long retval;
unsigned short cw387;
DWORD size;
DWORD alias;
size = numElems * sizeof(double);
if (Alloc16BitAlias (realArray, size, &alias) <0)
return <error code>;
cw387 = Get387CW();
retval = (long)
InvokeIndirectFunction (__static_WriteRealArray, alias,
numElems);
Set387CW (cw387);
Free16BitAlias (alias, size);
return retval;
}
4-10
Chapter 4
4-11
Chapter 4
You can terminate LabWindows/CVI programs in the middle of execution and then re-run
them. When you terminate the program, you should also terminate the asynchronous I/O. You
can arrange to be notified of changes in the run state by including a function with the name
RunStateChangeCallback in the .obj or .lib file associated with the DLL. You can add
this function to the glue code file. Refer to the Notification of Changes in Run State section
of Chapter 2, Using Loadable Compiled Modules, of this manual for a complete description
of the run state change notification. In the example we have been discussing, you should add
the following code.
#include "libsupp.h"
void CVICALLBACK __RunStateChangeCallback (int newState)
{
if (newState == kRunState_Stop)
ClearAsyncWrite ();
}
If you need direct callbacks to occur at interrupt time because the latency of
Windows messaging is interfering with your application, contact National
Instruments for assistance.
4-12
Chapter 4
You cannot pass pointers to 32-bit functions directly into 16-bit DLLs. The Windows SDK
interface for this is very complex. Generate DLL Glue Source does not generate this code
for you. You must write your own glue code for passing function pointers to and from a DLL,
and add it to the file that Generate DLL Glue Source generates.
Suppose a DLL contains the following functions:
long (FAR*savedCallbackPtr) (long);
long FAR InstallCallback(long (FAR*callbackPtr) (long))
{
savedCallbackPtr = callbackPtr;
}
long InvokeCallback(long data)
{
return (*savedCallbackPtr)(data);
}
After you use the Generate DLL Glue Source command to generate the glue code for these
functions, you must modify the code as follows.
Note
#undef MakeProcInstance
#undef FreeProcInstance
/*
/*
/*
/*
*/
*/
*/
*/
typedef struct {
4-13
Chapter 4
*/
*/
*/
*/
*/
*/
if ((CallbackData.UserDefinedProcHandle =
GetProcUserDefinedHandle()) == 0)
return FALSE;/* Too many callbacks installed
*/
/* or handles not freed.
*/
if (DefineUserProc16(CallbackData.UserDefinedProcHandle,
(PROCPTR) CallbackHelper, UDP16_DWORD,
UDP16_CDECL, UDP16_ENDLIST))
goto failed;
if (!(CallbackData.proc16 =
GetProc16((PROCPTR)CallbackHelper,
CallbackData.UserDefinedProcHandle)))
goto failed;
CallbackData.proc16Instance =
MakeProcInstance(CallbackData.proc16,
GetTaskInstance());
cw387 = Get387CW();
retval = (long)
InvokeIndirectFunction(__static_InstallCallback,
CallbackData.proc16Instance);
Set387CW(cw387);
return retval;
4-14
Chapter 4
failed:
FreeCallbackResources();
return FALSE;
}
/* Call this function after unregistering the callback. */
void FreeCallbackResources(void)
{
if (CallbackData.proc16Instance) {
FreeProcInstance(CallbackData.proc16Instance);
CallbackData.proc16Instance = 0;
}
if (CallbackData.proc16) {
ReleaseProc16(CallbackData.proc16);
CallbackData.proc16 = 0;
}
if (CallbackData.UserDefinedProcHandle) {
FreeProcUserDefinedHandle(CallbackData.UserDefinedProcHandle);
CallbackData.UserDefinedProcHandle = 0;
}
}
Pointers to memory that LabWindows/CVI allocates, that you pass into the DLL, and that
the DLL later returns
You must map these pointers back into normal 32-bit pointers that you can use in
LabWindows/CVI code. Use the function MapAliasToFlat to convert these pointers.
4-15
Chapter 4
Case 1
Assume the DLL has the following function:
char *f(char *ptr)
{
sprintf(ptr, "hello");
return ptr;
}
Case 2
Assume the DLL has the following function:
char *f(void)
{
char *ptr;
ptr = malloc(100);
sprintf(ptr, "hello");
return ptr;
}
4-16
Chapter 4
*/
4-17
Chapter 4
For the function f, the glue code that LabWindows/CVI generates converts the pointer to the
array ptrs to a 16-bit far pointer when you pass it to the DLL function, but does not convert
the pointers inside the array (ptrs[0], ptrs[1], ...). Similarly, for the function g, the
glue code that LabWindows/CVI generates converts the pointer to the structure (ptr), but not
the pointer inside the structure (name).
If your DLL has functions with these types of parameters, then your DLL cannot use glue
code automatically generated at load time. You can use the Generate DLL Glue Source
command to generate glue code and then modify it in the following manner.
1.
2.
b.
b.
Restore the hidden pointer with the value you saved in step 1.
For the functions f and g, the glue code that LabWindows/CVI generates looks like the
following excerpt:
int f(char **ptrs)
{
int retval;
unsigned short cw387;
cw387 = Get387CW();
retval = (int) InvokeIndirectFunction(__static_f, ptrs);
Set387CW(cw387);
return retval;
}
int g(struct x *ptr)
{
int retval;
unsigned short cw387;
4-18
Chapter 4
cw387 = Get387CW();
retval = (int) InvokeIndirectFunction(__static_g, ptr);
Set387CW(cw387);
return retval;
}
After you make the necessary changes, the code should appear as follows:
/* Assume NUM_ELEMENTS is the number of pointers in the input
/* array. Assume ITEM_SIZE is the number of bytes pointed
/* to by each pointer. If you do not know ITEM_SIZE, but you
/* know that it is 64K or less, you can use 64K as ITEM_SIZE.
int f(char **ptrs)
{
int retval;
unsigned short cw387;
int i;
char *savedPointers[NUM_ELEMENTS];
*/
*/
*/
*/
4-19
Chapter 4
Change to:
if (!(fp = GetProcAddress(DLLHandle, PASS_WORD_AS_POINTER(5))))
{
funcname = "_InstallCallback";
goto FunctionNotFoundError;
}
4-20
Chapter 4
Every function you call from outside the DLL must be far, exported, and must load the
data segment into the DS register. The function must load the DS register if you want to
use any non-local variables in a function.
Use the large or huge memory model. The savings you gain by using smaller memory
models is not worth having to use the far keyword throughout your code. This project
option is in CompilerMemory ModelSegment Setup.
You can make the compiler load the data segment into the DS register automatically by
using the SS!=DS, DS loaded on function entry project option in CompilerMemory
ModelSegment Setup.
If you try to use the optimize entry code option (/GD), by selecting
CompilerWindowsProlog/EpilogGenerate Prolog/Epilog For, it conflicts with the
4-21
Chapter 4
/Au option. You can either not use this option by setting it to None, or insert __loadds
You can make the compiler export a function by inserting __export between the return
type and the function name, or by adding the function name to the exports section of the
.def file.
If you add the function name to the exports section of the .def file, remember to convert
the name to all caps if you use the PASCAL calling convention, or pre-append an
underscore if you use the CDECL calling convention.
Every function you call from outside the DLL must be far, exported, and must load the
data segment into the DS register. The function must load the DS register if you want to
use any non-local variables in a function.
Use the large or huge memory model. The savings you gain by using smaller memory
models is not worth having to use the far keyword throughout your code. This project
option is in 16-bit CompilerMemory ModelMixed Model Override.
You can make the compiler load the data segment into the DS register by setting the
project option 16-bit CompilerMemory ModelAssume SS Equals DS to Never, or
by inserting _loadds in front of every function you export from the DLL.
You can make the compiler export a function by inserting _export between the return
type and the function name, adding the function name to the exports section of the .def
file, or setting the option 16-bit CompilerEntry/Exit CodeWindows DLL, all
functions exportable.
If you add the function name to the exports section of the .def file, remember to convert
the name to all caps if you use the PASCAL calling convention, or pre-append an
underscore if you use the CDECL calling convention. Also, set the Generate Underscores
option in CompilerCompiler Output.
Turn off the Case Sensitive Link and Case Sensitive Exports and Imports options in the
LinkerGeneral.
4-22
Chapter 4
If the .dll file is associated with a .fp file, LabWindows/CVI uses the following search
precedence to find the DLL.
1.
If a .pth file with the same full path name as the .fp file is in the project,
LabWindows/CVI uses the standard Windows DLL search algorithm. The .pth
file must contain the name of the .dll file, such as mystuff.dll. It must
contain an absolute path or a simple filename.
2.
If a .dll file with the same full path name as the .fp file is in the project,
LabWindows/CVI uses the absolute path of the .dll file in the project to load
the .dll file.
3.
If a .pth file with the same base name as the .fp file is in the same directory as
the .fp file and a .lib or .obj file of the same base name does not exist in the
same directory, LabWindows/CVI uses the standard Windows DLL search
algorithm. The .pth file must contain the name of the .dll file, such as
mystuff.dll. It must not contain any directory names or slashes.
4.
If a .dll file with the same base name as the .fp file is in the same directory as
the .fp file, LabWindows/CVI loads the .dll file as long as no .lib, .obj,
or .pth file of the same base name appears in the same directory.
5.
If a .pth or .dll file does not appear in the same directory as the .fp file,
LabWindows/CVI uses the standard Windows search algorithm to look for a
DLL with the same base name as the .fp file. Thus, if a DLL with the same base
name is in the windows or windows\system directory or a directory listed in
your PATH environment variable, LabWindows/CVI finds it.
DLLs for VXIplug&play drivers are not in the same directory as the .fp files, but the
directory that contains the DLL is listed in the PATH environment variable. Therefore,
Step 5 makes it easier for you to use VXIplug&play instrument driver DLLs in
LabWindows/CVI for Windows 3.1.
If the .dll file is not associated with a .fp file, LabWindows/CVI uses the following
search precedence to find the DLL:
1.
If a .pth file is in the project list, LabWindows/CVI uses the standard Windows
DLL search algorithm. The .pth file must contain the name of the .dll file,
such as mystuff.dll. It must contain an absolute path or a simple filename.
2.
If the .dll file is in the project list, then LabWindows/CVI uses the absolute
pathname to find the .dll file.
4-23
Chapter 4
If you specify it with a relative pathname, LabWindows/CVI searches for the .dll
file in the following places and order indicated.
1.
2.
3.
4.
the project or in one of the include paths you specify in the Include Paths
command in the Options menu of the Project window.
4-24
This chapter describes the kinds of compiled modules available under LabWindows/CVI for
UNIX and includes programming guidelines for modules you generate with external
compilers.
5-1
Chapter 5
Using dlopen
The Sun Solaris dlopen function allows you to load shared libraries from your program
dynamically. Although this function can work in some cases when running in
LabWindows/CVI, it can make LabWindows/CVI unstable. If you use dlopen to load shared
libraries in a program you run in LabWindows/CVI, the shared libraries might link to the
system libraries the LabWindows/CVI environment uses. As a result, functions in the shared
library might modify the LabWindows/CVI environment and cause unpredictable behavior.
5-2
Chapter 5
You can use an external compiler and linker to create an executable that uses the
Run-time Engine shared library. Use the Generate Makefile command in the Build menu
of the Project window to generate a UNIX makefile that corresponds to the currently
loaded project and libraries. The makefile invokes an external compiler to compile your
source files, and then it invokes the Sun Solaris linker (ld) to link the compiled files with
the Run-time Engine shared library.
Note
Under Solaris 2.4, when linking the LabWindows/CVI Shared Library with
external ANSI C compiler, the compiler displays a warning that states the shared
library has an invalid type. You can ignore this warning.
Static and Shared Versions of the ANSI C and Other Sun Libraries
When you build a project for execution in the LabWindows/CVI development environment,
LabWindows/CVI links your program to the static versions of the Sun Solaris libraries
(libc.a and libm.a). On the other hand, when you create a standalone executable in the
LabWindows/CVI development environment, LabWindows/CVI invokes the Sun Solaris link
editor (ld) to link your program to the shared versions of the libraries (libc.so and
libm.so). Similarly, when you generate a UNIX makefile by invoking the Generate
Makefile command from the Build Menu of the Project window, the makefile contains linker
commands to use the shared versions of the libraries.
Thus, when you run your programs as executables, you use a different version of the Sun
libraries (including the ANSI C library) than when you run them in the LabWindows/CVI
development environment. Your program might exhibit slightly different behavior as a
standalone executable than when run in the development environment.
5-3
Chapter 5
Some library functions have different behavior than the ANSI standard specifies.
The LabWindows/CVI versions of these functions provide run-time error checking not
available with Sun Solaris versions.
The Sun Solaris 1 version of these functions do not comply fully with the ANSI C
standard.
The Sun Solaris versions of these functions do not work with the LabWindows/CVI
implementation of the long double data type.
5-4
Chapter 5
National Instruments recommends that you always include source code similar to the
following example in your program.
int main(int argc, char *argv[])
{
if (InitCVIRTE(0, argv, 0) == 0) {
return 1;/* Failed to initialize */
}
/* your program code here */
}
If you pass NULL for the second argument to InitCVIRTE, your program might still work,
but with the following limitations:
Your executable cannot accept the -display command line argument. As a result, you
cannot specify an X display on the command line for your program to use. You still can
use the DISPLAY environment variable to specify a different X display.
executable to search for files, use the current working directory instead. If you run the
executable from a directory other than the one that contains your executable, some of
these functions might fail to find files.
5-5
Chapter 5
The objects must not use any data types that are incompatible with the LabWindows/CVI
compiler or libraries. Incompatible data types include the following:
long double with any Sun compilers. A Sun compiler implements long double
long long with the Solaris 2 Sun compiler. LabWindows/CVI does not support this
non-ANSI type.
Any enumeration type. Many compilers implement enumeration types with different
sizes and values.
You cannot load a Solaris 2 object file when you run LabWindows/CVI under Solaris 1.
However, you can load Solaris 1 objects when you run under Solaris 2.
When using the GNU compiler, use the -nostdinc flag to disable the standard include files
and the -I flag to add the LabWindows/CVI include directory to the search list. Also, you
must use the -ansi flag. For example, to compile the file mysource.c using
LabWindows/CVI headers under Solaris 1, use the following command line.
gcc -ansi -nostdinc -I/home/cvi/include -D_NI_sparc_=1 -c mysource.c
You might see warnings about conflicting types for the built-in functions memcmp and
memcpy, but you can ignore them.
Note
5-6
Chapter 5
You cannot use the non-ANSI C Sun compiler cc because it does not recognize some ANSI C
constructs in the header files, such as function prototypes and the keywords const, void, and
volatile.
Your LabWindows/CVI process must have superuser privileges to use the plock
function.
SIGINT and SIGQUITNormally, the operating system generates these two signals
when you type certain keystrokes (<Ctrl-C> and <Ctrl-\>) in the window from which
you invoke LabWindows/CVI. If one of these signals occurs while your program is
running and you have not installed a handler for it, LabWindows/CVI suspends
your program the next time it calls a function that processes events (such as
ProcessSystemEvents). If your program does not call any event-processing
functions, it continues to run.
5-7
Chapter 5
and suspends operation at the statement that caused the exception. If this signal occurs
when no program is running, LabWindows/CVI exits immediately.
You cannot use signal, sigaction, sigset, or sigvec to make your program ignore the
signals this section lists.
Note
If your program begins to loop indefinitely, you can often suspend execution by
sending a signal to the LabWindows/CVI process as follows:
1. Use the ps command to identify the process number of LabWindows/CVI.
2. Send the kill -SIGNAL pid command to that process. For example, if the
LabWindows/CVI process number is 3478, the command kill -INT 3478
sends the SIGINT signal to LabWindows/CVI. When you want to suspend
execution of your program in LabWindows/CVI, try using SIGINT or SIGQUIT.
If sending the SIGINT or SIGQUIT signal fails, you must use the stronger
SIGTERM signal, which terminates not just your program but also
LabWindows/CVI.
Note
Some signals can cause LabWindows/CVI to dump core you are running a
program that does not install handlers for them.
Some library functions have different behavior than the ANSI standard specifies.
5-8
Chapter 5
contains the following macro definition so that _cvi_realloc replaces all references to
realloc in your program.
#define realloc _cvi_realloc
Note
Object files you previously compiled using either older LabWindows/CVI headers
or Sun Solaris headers do not reference the replacement functions. You must
recompile your object files using LabWindows/CVI headers to obtain
ANSI-compliant behavior.
The following lists show the complete contents of the supplemental C library libcfix.a.
Replacement Functions
Name
Header
_cvi_fflush
stdio.h
_cvi_fopen
stdio.h
_cvi_freopen
stdio.h
Same as fopen.
_cvi_realloc
stdlib.h
_cvi_strtol
stdlib.h
_cvi_system
stdlib.h
matherr
5-9
Chapter 5
LabWindows/CVI for Solaris 1 uses the Sun Solaris version of the ANSI function
strftime, which incorrectly interprets the "%W" control string as the one-based week
number instead of the zero-based week number as ANSI specifies.
In LabWindows/CVI for Solaris 1, signal handlers you install with the signal function
remain installed after invocation of the handler. The ANSI standard specifies that these
handlers be removed before they are invoked.
Under some versions of Sun Solaris 2 (for example, Solaris 2.5), the ANSI function
setlocale does not work properly when running programs in the LabWindows/CVI
development environment. LabWindows/CVI links programs in the development
environment to the Sun Solaris static library libc.a, which contains a limited version
5-10
Chapter 5
LabWindows/CVI does not support the long long data type some header files on
Solaris 2 use. In LabWindows/CVI, you cannot use that data type or call functions that
use that data type.
LabWindows/CVI implements the data type long double as an 8-byte object, in the
same way that it implements double. Sun Solaris implements long double as a
16-byte object. As a result, Sun Solaris functions that use long double do not work
properly in LabWindows/CVI.
LabWindows/CVI does not support wide character constants (wchar_t) of the form
L'ab'.
The data types jmp_buf and sigjmp_buf that the header file setjmp.h defines are
different for LabWindows/CVI and Sun Solaris. The LabWindows/CVI versions of these
buffers are larger than the Sun Solaris versions because LabWindows/CVI stores
additional debugging information in them. As a result, you must be careful when you use
jmp_buf and sigjmp_buf objects among multiple files. In particular, if you compile a
file in LabWindows/CVI with debugging enabled and the file uses setjmp or longjmp,
then your program must include the LabWindows/CVI version of setjmp.h to handle
those functions correctly. The same is true for sigjmp_buf, sigsetjmp, and
siglongjmp.
5-11
Building Multiplatform
Applications
Observe and repair all LabWindows/CVI compile, link, and run-time diagnostics.
Avoid using non-portable image formats and fonts in your user interface.
Library Issues
Avoid using Windows 32-bit SDK functions unless you intend your LabWindows/CVI
application to run only under Windows 95/NT.
The sopen and fdopen functions are available only under Windows. Avoid using them
unless you intend your LabWindows/CVI application to run only under Windows.
Avoid using UNIX host system library calls such as ioctl, fcntl, and so on, unless you
intend the LabWindows/CVI application to run only under UNIX. Refer to the Using the
6-1
Chapter 6
If you use a GPIB instrument that sends two-byte binary data in Motorola byte order, use
Scan as shown in the following example:
Scan (instr_buf, "%100d[b2o10]>%100d[b2]", prog_buf);
In either case, use the [o] modifier only on the buffer that contains the raw data from the
instrument (instr_buf). LabWindows/CVI ensures that the program buffer (prog_buf)
uses the proper byte order for the host processor. For a full description of the [o] modifier,
refer to Chapter 2, Formatting and I/O Library, of the LabWindows/CVI Standard Libraries
Reference Manual.
6-2
Chapter 6
6-3
Creating and
Distributing Standalone
Executables and DLLs
This chapter describes how the LabWindows/CVI Run-time Engine, DLLs, externally
compiled modules, and other files interact with your executable file. This chapter also
describes how to perform error checking in a standalone executable program. You can
create executable programs from any project that runs in the LabWindows/CVI environment.
A minimum of 8 MB of memory
Free hard disk space equal to 4 MB, plus space to accommodate your executable or DLL
and any files the executable or DLL requires
7-1
Chapter 7
A math coprocessor
A minimum of 4 MB of memory
Free hard disk space equal to 2 MB, plus space to accommodate your executable and any
files the executable requires
7-2
Chapter 7
If your program loads .uir files with LoadPanel or loads external modules with
LoadExternalModule, use caution when you specify the filenames in calls to these
functions. If you use a relative path, the path is relative to the directory that contains
the executable. Refer to the Location of Files on the Target Machine for Running
Executables and DLLs section later in this chapter for more information.
2.
Create a directory to contain your executable program and associated files. Structure the
directory exactly as you want it to appear after installation. Test your program by running
it from that directory.
3.
From the directory that contains your executable program and associated files, execute
the makepkg shell script in the misc/bin directory of the LabWindows/CVI installation
directory to create a distribution package. The script requires the following information
to build the package:
Abbreviated package name that can have up to nine characters in the form
XYZmyapp
4.
The makepkg script creates the following files and directory structure. In the following
paths, pkgname stands for the name of your application package.
pkgname/install/copyright
pkgname/install/postinstall
pkgname/install/preremove
pkgname/pkginfo
pkgname/pkgmap
pkgname/reloc/pkgname/contents of application directory
You can now place the pkgname directory and its contents onto your distribution media.
5.
To run your executable, you must have the LabWindows/CVI Run-time Engine. You can
build the package for the LabWindows/CVI Run-time Engine by executing makecvirte
located in the misc/bin directory of the LabWindows/CVI installation directory. The
7-3
Chapter 7
makecvirte script prompts you to name the directory in which to place the completed
package. The package name is NICcvirte.
6.
To install or remove a package on a machine you must log in as root. You can then use
either of the following two methods to install or remove a package:
Use the Software Management Tool swntool located in the /usr/sbin directory
of your system.
If your program loads UIR files with LoadPanel or loads external modules with
LoadExternalModule, use caution when you specify filenames in calls to these
functions. If you use a relative path, the path is relative to the directory that contains the
executable. Refer to the Location of Files on the Target Machine for Running
Executables and DLLs section in this chapter for more information.
2.
Create a directory containing your executable program and associated files. Structure the
directory exactly as you want it to appear after installation. To test your program, run it
from that directory.
3.
Use the shell script makedist in the misc/bin directory to create a distribution
package. This script creates a compressed tar file that contains the directory you created
in Step 2 and a copy of the LabWindows/CVI Run-time Engine.
4.
Make a copy of the installation script INSTALL.sample in the misc/bin directory and
customize it using the information makedist provides. This installation script unpacks
a distribution package, creating a directory like the one you created in Step 2, and then
installs the LabWindows/CVI Run-time Engine. The installation script can install from
floppy disks or from the current directory.
5.
If you want to distribute your program on floppy disks, use the shell script makefloppy
in the misc/bin directory to copy your installation script and distribution package to
floppy disks. If you want to distribute using some other method, such as anonymous FTP,
you must provide users with the package file that makedist creates and the customized
installation script that extracts the files from the package.
You can use this method under Solaris 2 if you do not want to use the pkgmk utility.
7-4
Chapter 7
Sun SPARCstation
At least 24 MB of RAM
Free hard disk space equal to 4 MB, plus space to accommodate your executable and any
files the executable requires
2.
Use a text editor to modify msgrtn.txt. Translate only the text that is inside quotation
marks. You must not add or delete any message numbers.
3.
Execute the countmsg.exe or countmsg utility on the file to encode it for use with the
Run-time Engine, as in the following example:
countmsg msgrt5.txt
7-5
Chapter 7
the patch. The required patches are available in the misc/patch subdirectory of the
LabWindows/CVI installation directory. The following patches are available:
Under Windows 95/NT, set the configuration options in the Registry under the
following key:
HKEY_LOCAL_MACHINE\Software\National Instruments
\CVI Run-Time Engine\cvirte
Note
Under Windows 3.1, set the configuration options in the [cvirtn] section of the
win.ini file, where n is the version of the Run-time Engine.
Under UNIX, changes to options do not take effect until you restart your X server
or issue the xrdb .Xdefaults command.
7-6
Chapter 7
DSTRules
The LabWindows/CVI Run-time Engine recognizes the DSTRules option. It has the same
effect as in the LabWindows/CVI development environment. Refer to Chapter 1, Configuring
LabWindows/CVI, in the LabWindows/CVI User Manual, for more information
on DSTRules.
UNIX Options
The LabWindows/CVI Run-time Engine recognizes the activate, appFont, dialogFont,
editorFont, menuFont, messageBoxFont, useDefaultColors, useMetaKey, and
warpMouseOverDialogBoxes options under UNIX platforms. They have the same effect
as in the LabWindows/CVI development environment. Refer to Chapter 1, Configuring
LabWindows/CVI, in the LabWindows/CVI User Manual, for more information on these
options.
7-7
Chapter 7
startup code
program
execution
support
compiled
source code
memory
management
instrument
driver code
built-in
CVI Libraries
.obj's or .o's
.lib's or .a's
application
name & icon
resource
UIR,
image,
& state
files
DLLs
&
PTHs
external
.lib's or
.a's
external
.obj's or
.o's
other
files
Figure 7-1. Files Necessary to Run a LabWindows/CVI Executable Program on a Target Machine
Run-time EngineThe Run-time Engine contains all the built-in library, memory, and
program execution code present in the LabWindows/CVI environment, without all the
program development tools such as the source editor, compiler, debugger, and user
interface editor. The Run-time Engine is smaller than the LabWindows/CVI environment
and thus loads faster and requires less memory. You use only one copy of the Run-time
Engine on each target machine even when you have multiple executables. Under
7-8
Chapter 7
Windows 95/NT, the Run-time Engine consists of multiple files, including three DLLs
and the low-level support driver. Under Windows 3.1, the Run-time Engine is an
execute-only version of the LabWindows/CVI environment. Under Sun Solaris, the
Run-time Engine is a shared library
UIR filesThe User Interface Resource files that your application program uses. Use
LoadPanel and LoadMenuBar to load these files.
Image filesThe graphical image files that you programmatically load and display on
your user interface using DisplayImageFile.
State filesThe user interface panel state files that you save using SavePanelState
and load using RecallPanelState.
DLL files(Windows Only) the Windows Dynamic Link Library files that your
application program uses.
PTH files(Windows 3.1 Only) specify the location of DLL files when you want to
load the DLL from a special directory, or indicate that you want to find a DLL using
the standard Windows DLL search algorithm.
External .lib or .a filesCompiled 32-bit .lib files on the PC or .a files under UNIX
that you load using LoadExternalModule and that you have not listed in the project.
External .obj or .o filesCompiled 32-bit .obj files on the PC or .o files under UNIX
that you load using LoadExternalModule and that you have not listed in the project.
Other filesFiles your executable opens using open, fopen, OpenFile, and so on.
7-9
Chapter 7
Description
cvirt.dll
Helper DLL
cvirte.dll
cviauto.dll
cvi95vxd.vxd
cvintdrv.sys
msgrtn.txt
cvirtn.rsc
ni7seg.ttf
nisystem.ttf
These files come on a separate diskette, or in a separate directory in the CD-ROM. The
LabWindows/CVI installation program installs the files along with the development
environment. The Create Distribution Kit command in the Build menu of the Project
window can bundle the Run-time Engine DLLs and drivers into your distribution kit. Also,
you can make copies of this diskette, or the CD-ROM directory, for separate distribution.
7-10
Chapter 7
Windows NT. Under Windows NT, the installation program also adds a registry entry under
the following key:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\cvintdrv
Table 7-2 shows the values the installation program sets for the Windows NT registry entry
for the low-level support driver.
Table 7-2. Windows NT Registry Entry Values for the Low-Level Support Driver
Type
Name
Value
DWORD
ErrorControl
00000001
String
Group
"Extended Base"
DWORD
Start
00000002
DWORD
Type
00000001
You can subsequently change the location of the bin and fonts subdirectories, but you must
also change the cvidir registry option to the pathname of the directory that contains the two
subdirectories.
7-11
Chapter 7
the Run-time Engine into your distribution kit. Also, you can make copies of this diskette for
separate distribution. The user selects the directory into which to install the Run-time Engine.
The LabWindows/CVI Run-time Engine does not include the DLLs or drivers for National
Instruments hardware. Users can install the DLLs or drivers for their hardware from the
distribution disks that National Instruments supplies.
Pathname of Link
Target of Link
/usr/lib/libcvi.so
/usr/lib/libcvi.so.n
/usr/lib/libcvi.so.n
cvirte/lib/libcvi.so.n
The installation program installs message and resource files in the bin directory under the
Run-time Engine installation directory. It installs font description files in the fonts directory
under the Run-time Engine installation directory. You can subsequently change the location
of the bin and fonts subdirectories, but you must also change the cvidir configuration
option to the pathname of the directory that contains the two subdirectories.
The LabWindows/CVI Run-time Engine does not include the shared libraries or drivers for
National Instruments hardware. Users can install the shared libraries and drivers for their
hardware from the distribution disks that National Instruments supplies.
Rules for Accessing UIR, Image, and Panel State Files on All Platforms
The recommended method for accessing UIR, image, and panel state files in your executable
program is to place the files in the same directory as the executable and pass simple filenames
with no drive letters or directory names to LoadPanel, DisplayImageFile,
SavePanelState, and RecallPanelState.
If you do not want to store these files in the same directory as your executable,
you must pass pathnames to LoadPanel, DisplayImageFile, SavePanelState, and
RecallPanelState. These functions interpret relative pathnames as being relative to the
directory that contains the executable.
7-12
Chapter 7
Associate it with the .fp file for an instrument driver or user library.
If you list a DLL import library in the project or associate it with an instrument driver or user
library, LabWindows/CVI statically links the import library into your executable or DLL. On
the other hand, if you load the import library through a call to LoadExternalModule, you
must distribute it separately from your executable. Refer to the Rules for Loading Files Using
LoadExternalModule section later in this chapter for more information.
Regardless of the method you use to link the import library, you must distribute the subsidiary
DLL separately. The import library always contains the name of the subsidiary DLL. When
your executable or DLL is loaded, the operating system finds the subsidiary DLL using the
standard DLL search algorithm, which the Windows SDK documentation for the
LoadLibrary function describes. The search precedence is as follows:
1.
2.
3.
Under Windows 95, the Windows system directory. Under Windows NT, the Windows
system32 and system directories
4.
5.
The Create Distribution Kit command automatically includes in your distribution kit the
DLLs that the import libraries in your project refer to. You must add to the distribution kit
any DLLs that you load through LoadExternalModule or that you load by calling the
Windows SDK LoadLibrary function.
Do not include DLLs for National Instruments hardware in your distribution kit. The user
must install these DLLs from the distribution disks that National Instruments supplies.
7-13
Chapter 7
Do not include DLLs for National Instruments hardware in your distribution kit. The user
must install these DLLs from the distribution disks that National Instruments supplies.
If you use LoadExternalModule to load DLLs, refer to the following section, Rules for
Loading Files Using LoadExternalModule.
If you use a DLL file, a DLL path file, or a DLL glue object module in your project or as an
instrument driver, the Run-time Engine always looks for a corresponding DLL path ( .pth)
file before it looks for the DLL itself. This search mechanism lets the user of your executable
place the DLLs anywhere on the target computer. The Run-time Engine uses the following
DLL search method.
1.
Look for a .pth file in the directory of the executable. The .pth file must have the same
base name as the file in the project or as the instrument driver. If the .pth file contains
an absolute path to the DLL, use that path to find the DLL. If the .pth file contains a
simple filename, use the standard Windows DLL search algorithm: directory of
executables, current working directory, \windows, \windows\system, then the PATH
environment variable.
2.
Look for a .dll file in the directory of the executable. The .dll file must have the same
base name as the file in the project or as the instrument driver.
3.
Note
Before searching for a .dll file, the Run-time Engine always looks for a
.pth file. Therefore, your choice of whether to use a .pth file when you develop
your application in the LabWindows/CVI environment does not restrict your
choice of whether to use a .pth file in the standalone application.
Library Files:
Object Modules:
DLL Files:
Source Files:
7-14
Chapter 7
If you link your executable or DLL in LabWindows/CVI, the following rules apply for
files listed in the project:
For .dll or .pth files (Windows 3.1 only), refer to the Rules for Using DLL Files
under Windows 3.1 section earlier in this chapter.
For .lib files, by default, Create Standalone Executable File or Create Dynamic
Link Library only links in the library modules that you reference statically in the
project. Therefore, you must force into the executable the modules that contain the
functions you call using GetExternalModuleAddr.
To force these modules into the executable, include the library file in the project and
take one of the following actions:
If you want to force the entire library file into the executable, use the Add Files
to Executable button in the Create Standalone Executable File dialog box, or
the Add Files to DLL button in the Create Dynamic Link Library dialog box.
7-15
Chapter 7
If you want to force only specific modules from the library into the executable,
reference them statically in your program. For example, you could have an array
of void pointers and initialize them to the names of the necessary symbols.
If you link in an external compiler under Windows 95/NT, the LabWindows/CVI Utility
library does not know the location of symbols in the externally linked executable or DLL.
Consequently, without further action on your part, you cannot call
GetExternalModuleAddr or RunExternalModule on modules that you link directly
into your executable or DLL. Your alternatives are as follows.
1.
Remove the file from the project and distribute it as a separate .obj, .lib,
or .dll.
2.
Use the Other Symbols section of the External Compiler Support dialog box in
the Build menu of the Project window to create an object module that contains
a table of symbols you want GetExternalModuleAddr to find. If you use this
method, pass the empty string ("") to LoadExternalModule as the module
pathname. The empty string indicates that you linked the module directly into
your executable or DLL using an external compiler.
7-16
Chapter 7
2.
3.
Under Windows 95, the Windows system directory. Under Windows NT, the Windows
system32 and system directories
4.
5.
Look for a .pth file in the directory of the executable. The .pth file must have the same
base name as the file you passed to LoadExternalModule. If the .pth file contains an
absolute path to the DLL, use that path to find the DLL. If the .pth file contains a simple
filename, use the standard Windows DLL search algorithm: directory of executables,
7-17
Chapter 7
Look for a .dll file in the directory of the executable. The .dll file must have the same
base name as the file you passed to LoadExternalModule.
3.
If you maintain the DLL glue object module as a separate file from the executable, you must
pass LoadExternalModule a pathname to the DLL glue object module, and it uses the
following search method to find the DLL.
1.
Look for a .pth file that is in the same directory as the DLL glue object module and that
has the same base name as the DLL glue object module. If the .pth file contains an
absolute path to the DLL, use it to find the DLL. If the .pth file contains a simple
filename, use the standard Windows DLL search algorithm.
2.
Look for a .dll file that is in the same directory as the DLL glue object module and that
has the same base name as the DLL glue object module.
3.
Note
Before searching for a .dll file, a standalone executable always looks for a
.pth file. Therefore, your choice of whether to use a .pth file when you develop
your application in the LabWindows/CVI environment does not restrict your
choice of whether to use to .pth file in the standalone application.
Refer to one of the variables or functions it exports in one of your project files.
If the source file is an instrument program that is not in the project and you link in an external
compiler, you must create an object file and keep it separate from the executable.
7-18
Chapter 7
7-19
Distributing Libraries
and Function Panels
This chapter describes how to distribute libraries, add libraries to a users Library menu, and
specify library dependencies.
8-1
Chapter 8
To add the libraries to the users Library menu under Windows 3.1 and UNIX, your modini
command file must be:
add Libraries LibraryFPFile "c:\newlib\lib1.fp"
add Libraries LibraryFPFile "c:\newlib\lib2.fp"
After the user installs the library files, the modini program must be run on the users disk
using cvi.ini and the command file.
To add the libraries to the users Library menu under Windows 95/NT, your modreg
command file must be:
setkey
[HKEY_CURRENT_USER\Software\National Instruments]
appendkey CVI\@latestVersion
add Libraries LibraryFPFile "c:\newlib\lib1.fp"
add Libraries LibraryFPFile "c:\newlib\lib2.fp"
After the user installs the library files, the modreg program must be run on the users disk
using the command file.
Caution
LabWindows/CVI must not be running when you use the modini or modreg
program to modify cvi.ini or the Registry. If LabWindows/CVI is running while
you use these programs, you will lose your changes.
8-2
Chapter 8
If liba depends on libb, you must add the following path to the users Instrument
Directories list:
c:\genlib
For LabWindows/CVI to be able to find the dependent file under Windows 3.1 and UNIX,
your modini command file must be,
add InstrumentDirectories InstrDir "c:\genlib"
After the user installs the library files, the modini program must be run on the users disk
using cvi.ini and the command file.
For LabWindows/CVI to be able to find the dependent file under Windows 95/NT, your
modreg command file must be,
setkey
[HKEY_CURRENT_USER\Software\National Instruments]
appendkey CVI\@latestVersion
add InstrumentDirectories InstrDir "c:\gewlib"
After the user installs the library files, the modreg program must be run on the users disk
using the command file.
Caution
LabWindows/CVI must not be running when you use the modini or modreg
program to modify cvi.ini or the Registry. If LabWindows/CVI is running while
you use these programs, you will lose your changes.
8-3
This chapter describes LabWindows/CVI error checking and how LabWindows/CVI reports
errors in LabWindows/CVI libraries and compiled external modules.
When you develop applications in LabWindows/CVI, you usually have debugging and the
Break on Library Errors option enabled. With these features enabled, LabWindows/CVI
identifies and reports programming errors in your source code. Therefore, you might have a
tendency to relax your own error checking. However, in compiled modules and standalone
executables, debugging and the Break on Library Errors are disabled. This results in smaller
and faster code, but you must perform your own error checking. This fact is important to
remember because many problems can occur in compiled modules and standalone
executables even if the program works inside the environment.
It is important to check for errors that can occur because of external factors beyond the control
of your program. Examples include running out of memory or trying to read from a file that
does not exist. malloc, fopen, and LoadPanel are examples of functions that can encounter
such errors. You must provide your own error checking for these types of functions. Other
functions return errors only if your program is incorrect. The following function call returns
an error only if pnl or ctrl is invalid.
SetCtrlAttribute(pnl, ctrl, ATTR_DIMMED, FALSE);
The Break on Library Errors feature of LabWindows/CVI adequately checks for these types
of errors while you develop your program, and external factors do not affect this function call.
Therefore, it is generally not necessary to perform explicit error checking on this type of
function call.
One method of error checking is to check the status of function calls upon their completion.
Most functions in commercial libraries return errors when they encounter problems.
LabWindows/CVI libraries are no exception. All the functions in the LabWindows/CVI
libraries and in the instrument drivers available from National Instruments return a status code
to indicate the success or failure of execution. These codes help you determine the problem
when the program does not run as you expected it to. This chapter describes how
LabWindows/CVI reports these status codes and some techniques for checking them.
9-1
Chapter 9
Note
Status codes are integer values. These values are either common to an entire
library of functions, or specific to one function. Libraries that have a common set
of codes have a listing at the end of the chapter or manual they appear in. You can
find the error message for each integer value there. In addition, each of these
libraries contains a function you can call to translate the integer value to an error
string. When an error code is specific to a function, you can find a description for
it in the function description in the LabWindows/CVI manual set. The error
description also appears in the online help of the library function panels in
LabWindows/CVI.
Error Checking
LabWindows/CVI functions return status codes in one of two wayseither by a function
return value, or by updating a global variable. In some cases, LabWindows/CVI uses both of
these methods. In either case, it is a good idea to monitor these values so that you can detect
an error and take appropriate action. A common technique for error checking is to monitor the
status of functions, and when a function reports an error, pause the program and report the
error to the user through a pop-up message. For example, LoadPanel returns a positive
integer when it successfully loads a user interface panel into memory. However, if a problem
occurs, the return value is negative. The following example shows an error message handler
for LoadPanel.
panelHandle = LoadPanel (0, "main.uir", PANEL);
if (panelHandle < 0) {
ErrorCheck ("Error Loading Main Panel", panelHandle,
GetUILErrorString (panelHandle));
}
When a function reports status through a separate function, as in the RS-232 Library, check
for errors in a similar way. In this case, the status function returns a negative value when the
original function fails.
bytesRead = ComRd (1, buffer, 10);
if (ReturnRS232Error() < 0) {
ErrorCheck ("Error Reading From ComPort #1", ReturnRS232Error(),
GetRS232ErrorString(ReturnRS232Error()));
}
Notice that the above function also returns the number of bytes read from the serial port. You
can compare the number of bytes read to the number you request, and if a discrepancy exists,
take the appropriate action. Notice that the error codes differ between the RS-232 Library and
the User Interface Library. A section describing how each LabWindows/CVI library reports
errors follows this section.
9-2
Chapter 9
After your program detects an error, it must take some action to either correct the situation or
prompt the user to select a course of action. The following example shows a simple error
response function.
void ErrorCheck (char *errMsg, int errVal, char *errString)
{
char outputMsg[256];
int response;
Fmt (outputMsg, "%s (Error = %d).\n%s\nContinue? ",
errMsg,errVal,errString);
response = ConfirmPopup ("ErrorCheck", outputMsg);
if (response == 0)
exit (-1);
}
9-3
Chapter 9
VXI Library
The VXI Library uses a variety of global variables and function return codes to report any
error that occurs. You must check each function description to determine what error checking
might be necessary. Refer to the specific VXI function reference manual or the on-line help
for a listing of the error codes.
If your program uses multiple threads, use the ThreadIbsta and ThreadIberr
functions in place of the ibsta and iberr global variables.
Note
The GPIB Library functions return the same value that they assign to ibsta. You
can choose to use either the return values, ibsta, or ThreadIbsta.
The ERR bit within ibsta indicates an error condition. If this bit is not set, iberr does not
contain meaningful information. If the ERR bit is set in ibsta, the error condition is stored in
9-4
Chapter 9
iberr. After each GPIB call, your program should check whether the ERR bit is set to
determine if an error has occurred, as shown in the following code segment.
if (ibwrt(bd[instrID], buf, cnt) & ERR)
PREFIX_err = 230;
Refer to your NI-488.2 Function Reference and user manuals for detailed information on
GPIB global variables and listings of status and error codes. LabWindows/CVI function panel
help also has listings of status and error codes.
RS-232 Library
The RS-232 library returns status information through a global variable called rs232err. If
this variable is negative after the function returns, an error occurred. Notice that many of the
functions return a value in addition to setting the global variable. Usually, this value contains
information on the result of the function that can also be used to detect a problem. Each
function should be checked individually. Refer to the RS-232 section in the LabWindows/CVI
Standard Libraries Reference Manual or the function panel help for a listing of the error codes
and information on the individual functions. You can use GetRS232ErrorString to get the
error message associated with each RS-232 Library error code.
Note
VISA Library
The VISA Library functions return a negative value when they detect an error. They return a
positive value as a warning when they can complete their task but not in the way you might
expect. This library uses a common set of error and warning codes, but the warning code
values are entirely separate from the error code values. The error codes always contain
0xBFFF in the upper two bytes. The warning codes always contain 0x3FFF in the upper two
bytes. Refer to the NI-VISA Programmer Reference Manual or the function panel help for a
listing of the error and warning codes and information on the individual functions. You can
use viStatusDesc to obtain the error message associated with each VISA Library error
code.
IVI Library
The IVI Library functions return a negative value when they detect an error. This library uses
a common set of error codes. Refer to the LabWindows/CVI Instrument Driver Developers
Guide or the function panel help for a listing of the error codes and information on the
individual functions. IVI Library functions sometimes also provide a secondary error code or
an elaboration string to give you additional information about an error condition. You can use
Ivi_GetErrorInfo to obtain the primary error code, secondary error code, and the
elaboration string. You can use Ivi_GetErrorMessage to obtain the error message
associated with each IVI Library error code.
National Instruments Corporation
9-5
Chapter 9
TCP Library
The TCP Library functions return a negative value when they detect an error. This library uses
a common set of error codes, which the LabWindows/CVI Standard Libraries Reference
Manual and the LabWindows/CVI function panel help list. You can use
GetTCPErrorString to get the error message associated with each TCP Library error code.
DDE Library
The DDE Library functions return a negative value when they detect an error. This library
uses a common set of error codes, which the LabWindows/CVI Standard Libraries Reference
Manual and the LabWindows/CVI function panel help list. You can use the function
GetDDEErrorString to get the error message associated with each DDE Library error code.
X Property Library
The X Property Library functions return a negative value when they detect an error. This
library uses a common set of error codes, which the LabWindows/CVI Standard Libraries
Reference Manual and the LabWindows/CVI function panel help list. You can use the
function GetXPropErrorString to get the error message associated with each X Property
Library error code.
9-6
Chapter 9
Formatting and I/O Library function that performed file I/O. The GetFmtIOErrorString
function converts this code into an error string. Refer to the LabWindows/CVI Standard
Library Reference Manual for more information.
Utility Library
Utility Library functions report error codes as return values. You can check each individual
function description in the LabWindows/CVI Standard Libraries Reference Manual or in the
LabWindows/CVI function panel help to determine the error conditions that can occur in each
function.
ANSI C Library
Some of the ANSI C library functions report error codes as return values. Some functions also
set the global variable errno. Generally, the functions do not clear errno when they return
successfully. To learn more about these values, you can consult a publication such as C: A
Reference Manual cited in the Related Documentation section of About This Manual. Also,
you can use the LabWindows/CVI function panel help to determine the error conditions that
can occur in each function.
instrument driver functions sometimes also provide a secondary error code or an elaboration
string to give you additional information about an error condition. You can use
Prefix_GetErrorInfo to obtain the primary error code, secondary error code, and the
elaboration string for the first error that occurred on a particular instrument session or in the
current thread since you last called Prefix_GetErrorInfo. You also can use the
Prefix_GetAttribute function to obtain each of these data items, individually, for the
most recent function call on a particular instrument session.
9-7
This appendix contains an alphabetized list of compiler warnings, compiler errors, link errors,
DLL loading errors, and external module loading errors generated by LabWindows/CVI.
Table A-1. Error Messages
Error Message
Type Error
Comment
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
#ifdef expects an
identifier.
Compile
Error
#ifndef expects an
identifier.
Compile
Error
Compile
Error
Compile
Error
Compile
Error
## at beginning of macro
definition.
Compile
Error
A-1
Appendix A
Error Message
Type Error
Comment
## at end of macro
definition.
Compile
Error
, or ) expected.
Compile
Error
Non-Fatal
Run-time Error
Link Error
Link Error
Link Error
PC/Windows
Load Error
Compile
Warning
Anonymous struct
declared inside
parameter list has scope
only for this
declaration.
Compile
Warning
A-2
Appendix A
Error Message
Type Error
Comment
Compile
Warning
Argument 4 must be 0
or 1.
Fatal
Run-time Error
Fatal
Run-time Error
Argument must be a
function pointer to the
correct type of callback
function.
Non-Fatal
Run-time Error
Fatal
Run-time Error
Argument must be
character.
Fatal
Run-time Error
Fatal
Run-time Error
Fatal
Run-time Error
Non-Fatal
Run-time Error
Assertion error:
EXPRESSION.
Fatal
Run-time Error
A-3
Appendix A
Error Message
Type Error
Comment
Assignment between
TYPE and TYPE is
compiler-dependent.
Compile
Warning
Assignment of invalid
pointer value.
Non-Fatal
Run-time Error
Assignment of
out-of-bounds pointer:
NUMBER bytes before
start of array.
Non-Fatal
Run-time Error
Assignment of
out-of-bounds pointer:
NUMBER bytes past end of
array.
Non-Fatal
Run-time Error
Assignment of pointer to
freed memory.
Non-Fatal
Run-time Error
Assignment of
uninitialized pointer
value.
Non-Fatal
Run-time Error
A-4
Appendix A
Error Message
Type Error
Comment
Assignment to const
identifier NAME.
Compile
Error
Assignment to const
location.
Compile
Error
Fatal
Run-time Error
Fatal
Run-time Error
Attempt to free
uninitialized pointer.
Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Attempt to realloc
invalid pointer
expression.
Fatal
Run-time Error
Attempt to realloc
pointer to freed memory.
Fatal
Run-time Error
A-5
Appendix A
Error Message
Type Error
Comment
Attempt to realloc
uninitialized pointer.
Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Object Load
Error
Object Load
Error
Object Load
Error
Link Error
Link Error
Link Error
Link Error
A-6
Appendix A
Error Message
Type Error
Comment
PC/Windows
Load Error
Link Error
PC/Windows
Load Error
Byte ordering is
invalid.
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
A-7
specifier.
Appendix A
Error Message
Type Error
Comment
Compile
Warning
Compile
Warning
Fatal
Run-time Error
Glue Code
Generation
Error
Glue Code
Generation
Error
Glue Code
Generation
Error
Cannot initialize
undefined TYPE.
Compile
Error
Link Error
A-8
Appendix A
Error Message
Type Error
Comment
Link Error
Compile
Error
Compile
Error
Compiler Error
Object Load
Error
Comparison involving
null pointer.
Non-Fatal
Run-time Error
Comparison involving
uninitialized pointer.
Non-Fatal
Run-time Error
Comparison of pointers
to different objects.
Non-Fatal
Run-time Error
Comparison of pointers
to freed memory.
Non-Fatal
Run-time Error
A-9
Appendix A
Error Message
Type Error
Comment
Compound statements
nested too deeply.
Compile
Error
Conditional inclusion
nested too deeply.
Compile
Error
Conflicting GRPDEFs:
group name NAME.
Link Error
Conflicting argument
declarations for
function FUNCTION.
Compile
Error
Compile
Error
Conversion from
TYPE to TYPE is
compiler-dependent.
Compile
Warning
Fatal
Run-time Error
A-10
Appendix A
Error Message
Type Error
Comment
Glue Code
Generation
Error
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
"defined" expects an
identifier argument.
Compile
Error
Dereference of a NUMBER
byte object where only
NUMBER bytes exist.
Fatal
Run-time Error
Dereference of data
pointer used as a
function.
Fatal
Run-time Error
A-11
Appendix A
Error Message
Type Error
Comment
Dereference of function
pointer used as data.
Fatal
Run-time Error
Dereference of invalid
pointer expression.
Fatal
Run-time Error
Dereference of null
pointer.
Fatal
Run-time Error
Dereference of
out-of-bounds pointer:
NUMBER bytes (NUMBER
elements) before start
of array.
Fatal
Run-time Error
Dereference of
out-of-bounds pointer:
NUMBER bytes (NUMBER
elements) past end of
array.
Fatal
Run-time Error
Dereference of pointer
to freed memory.
Fatal
Run-time Error
Dereference of unaligned
pointer.
Fatal
Run-time Error
[UNIX only]
A-12
Appendix A
Error Message
Type Error
Comment
Dereference of
uninitialized pointer.
Fatal
Run-time Error
Compile
Error
Compile
Error
Compile
Error
Dynamic memory is
corrupt.
Fatal
Run-time Error
Empty declaration.
Compile Error
or Warning
Object Load
Error
Compile
Warning
A-13
Appendix A
Error Message
Type Error
Comment
Error at or near
character NUMBER in the
format string: STRING.
Non-Fatal
Run-time Error
Object Load
Error
DLL Import
Library
Creation Error
Expecting an enumerator
identifier.
Compile
Error
Expecting an identifier.
Compile
Error
Expecting integer
constant, push, or pop.
Compile
Error
Compile
Error
Compile
Warning
A-14
Appendix A
Error Message
Type Error
Comment
Extraneous formal
parameter
specification.
Compile
Error
Extraneous identifier
NAME.
Compile
Error
Compile
Error
Link Error
Object Load
Error
Compile
Error
A-15
Appendix A
Error Message
Type Error
Comment
Compile
Error
Non-Fatal
Run-time Error
Compile Error
or Warning
Compile
Error
Function FUNCTION:
(STRING == NUMBER).
Non-Fatal
Run-time Error
Glue Code
Generation
Error
Glue Code
Generation
Error
Non-Fatal
Run-time Error
Compile
Error
A-16
Appendix A
Error Message
Type Error
Comment
Ill-formed constant
integer expression.
Compile
Error
Ill-formed hexadecimal
escape sequence \xCHAR.
Compile
Error
Ill-formed hexadecimal
escape sequence.
Compile
Error
Illegal argument(s) to
library function.
Fatal
Run-time Error
Compile
Error
Compile
Error
Illegal continue
statement.
Compile
Error
statement.
Illegal default label.
Compile
Error
label.
Illegal expression.
Compile
Error
Illegal extern
definition of NAME; all
interactive window
variable definitions
must be static.
Compile
Error
A-17
Appendix A
Error Message
Type Error
Comment
Compile
Error
Compile
Error
Illegal initialization
for NAME.
Compile
Error
Illegal initialization
for parameter.
Compile
Error
Illegal initialization
for parameter NAME.
Compile
Error
Illegal initialization
of extern NAME.
Compile
Error
Illegal return
type TYPE.
Compile
Error
A-18
Appendix A
Error Message
Type Error
Comment
Illegal return
type; found TYPE
expected TYPE.
Compile
Error
Illegal separator
character or illegal
position of separator
character.
Non-Fatal
Run-time Error
Compile
Error
Illegal statement
termination.
Compile
Error
Compile
Error
A-19
Appendix A
Error Message
Type Error
Comment
Compile
Error
Compile
Error
prototype.
int__stdcall DllMain
(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved);
Compile
Error
prototype.
int__stdcall WinMain
(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow);
Compile
Error
Compile
Error
Non-Fatal
Run-time Error
A-20
Appendix A
Error Message
Type Error
Comment
Illegal variable
declaration; only static
and extern variable
classes are valid in the
interactive window.
Compile
Error
Compile
Error
Compile
Error
Compile
Error
Inconsistent type
declarations for
external symbol NAME in
modules FILE1 and FILE2.
Link Error
Initializer exceeds
bit-field width.
Compile
Warning
Initializer must be
constant.
Compile
Error
Insufficient number of
arguments to FUNCTION.
Compile
Error
A-21
Appendix A
Error Message
Type Error
Comment
Insufficient system
memory for Interactive
Window
Link Error
Insufficient system
memory for project.
Link Error
Link Error
Invalid hexadecimal
constant.
Compile
Error
Invalid initialization
type; found TYPE
expected TYPE.
Compile
Error
Compile
Error
Compile
Error
Fatal
Run-time Error
A-22
Appendix A
Error Message
Type Error
Comment
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
Compile
Error
Invalid type
specification.
Compile
Error
A-23
Appendix A
Error Message
Type Error
Comment
Compile
Error
Compile
Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
A-24
format specifiers.
Appendix A
Error Message
Type Error
Comment
Non-Fatal
Run-time Error
Lvalue required.
Compile
Error
Compile
Error
Compile
Error
Compile
Error
Missing { in
initialization of TYPE.
Compile
Error
Missing #endif
Compile
Error
source file.
Missing #include file
name; #include expects
"FILE" or <FILE>.
Compile
Error
Missing '.
Compile
Error
Missing CHAR.
Compile
Error
A-25
Appendix A
Error Message
Type Error
Comment
Missing argument to
variable argument
function.
Fatal
Run-time Error
Compile
Error
Non-Fatal
Run-time Error
Missing identifier.
Compile
Error
Compile
Error
Compile
Error
Compile
Error
A-26
Appendix A
Error Message
Type Error
Comment
Missing prototype.
Compile
Error
Fatal
Run-time Error
Compile
Warning
Missing right
bracket (]).
Fatal
Run-time Error
Compile
Error
Fatal
Run-time Error
Compile
Error
Link Error
Compile
Error
NAME is a predefined
macro and cannot be the
subject of an #undef.
Compile
Error
A-27
Appendix A
Error Message
Type Error
Comment
No data relocation
section found for
external module: FILE.
Link Error
No data section
found for external
module: FILE.
Link Error
No pack settings
currently pushed.
Compile
Error
No symbol table
found for external
module: FILE.
Link Error
No text relocation
section found for
external module: FILE.
Link Error
No text section
found for external
module: FILE.
Link Error
Non-terminated
address list.
Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
A-28
Appendix A
Error Message
Type Error
Comment
Null Pointer.
Fatal
Run-time Error
Fatal
Run-time Error
NUMBER is an illegal
array size.
Compile
Error
Compile
Error
NUMBER line(s)
truncated. File set to
read-only.
Compile
Error
Number of arguments
exceed the maximum
supported.
Non-Fatal
Run-time Error
Fatal
Run-time Error
Object Load
Error
Glue Code
Generation
Error
Link Error
A-29
Appendix A
Error Message
Type Error
Comment
Operands of = have
incompatible calling
conventions.
Compile
Error
Compile
Error
Compile
Error
Operand of unary
OPERATOR has illegal
type TYPE.
Compile
Error
Out-of-bounds pointer
argument (before start
of array).
Fatal
Run-time Error
Out-of-bounds pointer
argument (past end of
array).
Fatal
Run-time Error
Out-of-bounds pointer
arithmetic: NUMBER bytes
(NUMBER elements) before
start of array.
Non-Fatal
Run-time Error
Out-of-bounds pointer
arithmetic: NUMBER bytes
(NUMBER elements) past
end of array.
Non-Fatal
Run-time Error
Fatal
Run-time Error
A-30
Appendix A
Error Message
Type Error
Comment
Overflow in constant
CONSTANT.
Compile
Warning
Overflow in constant
expression.
Compile
Warning
Overflow in floating
constant CONSTANT.
Compile
Warning
Overflow in hexadecimal
escape sequence.
Compile
Warning
Compile
Warning
Compile
Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
A-31
Appendix A
Error Message
Type Error
Comment
Compile
Error
Parameter type
incompatible with format
specifier.
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Pointer arithmetic
involving invalid
pointer.
Non-Fatal
Run-time Error
Pointer arithmetic
involving null pointer.
Non-Fatal
Run-time Error
Pointer arithmetic
involving pointer to
freed memory.
Non-Fatal
Run-time Error
Pointer arithmetic
involving pointer to
function.
Non-Fatal
Run-time Error
Pointer arithmetic
involving uninitialized
pointer.
Non-Fatal
Run-time Error
Pointer comparison
involving address of
nonarray object.
Non-Fatal
Run-time Error
A-32
Appendix A
Error Message
Type Error
Comment
Pointer is invalid.
Non-Fatal
Run-time Error
Non-Fatal
Run-time Error
Pointer subtraction
involving address of
nonarray object.
Non-Fatal
Run-time Error
Pointer to a local is an
illegal return value.
Compile
Error
Pointer to a parameter
is an illegal return
value.
Compile
Error
Fatal
Run-time Error
Compile
Warning
A-33
Appendix A
Error Message
Type Error
Comment
Link Warning
Compile
Warning
Read error.
Link Error
Redeclaration of %s
with different calling
convention, previously
declared at %w.
Compile
Error
Redeclaration of macro
parameter NAME.
Compile
Error
Redeclaration of NAME.
Compile
Error
Redeclaration of NAME
previously declared at
POSITION.
Compile
Error
A-34
Appendix A
Error Message
Type Error
Comment
Redefinition of label
NAME previously defined
at POSITION.
Compile
Error
Redefinition of
macro NAME.
Compile
Error
Redefinition of NAME
previously defined at
POSITION.
Compile
Error
Reference parameter
expected.
Non-Fatal
Run-time Error
Register declaration
ignored for TYPE NAME.
Compile
Warning
Register declaration
ignored for TYPE
parameter.
Compile
Warning
Non-Fatal
Run-time Error
Result of unsigned
comparison is constant.
Compile
Warning
A-35
Appendix A
Error Message
Type Error
Comment
Segment must be of
class CODE, DATA, BSS,
or STACK: segment
name NAME.
Load Error
Link Error
Compile
Warning
Simple/Array conflict
with format specifier.
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
Compile
Error
Non-Fatal
Run-time Error
A-36
Appendix A
Error Message
Type Error
Comment
Stack Overflow.
Fatal
Run-time Error
Compile
Warning
Structures containing
unspecified size array
fields must contain
other fields.
Compile
Error
Subtraction involving
invalid pointer.
Non-Fatal
Run-time Error
Subtraction involving
null pointer.
Non-Fatal
Run-time Error
Subtraction involving
uninitialized pointer.
Non-Fatal
Run-time Error
Subtraction of pointers
to different objects.
Non-Fatal
Run-time Error
A-37
Appendix A
Error Message
Type Error
Comment
Subtraction of pointers
to freed memory.
Non-Fatal
Run-time Error
Compile
Warning
Link Error
A-38
Appendix A
Error Message
Type Error
Comment
Compile
Error
Compile
Error
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
Compile
Error
A-39
Appendix A
Error Message
Type Error
Comment
Non-Fatal
Run-time Error
Compile
Error
Compile
Error
Compile
Error
Type error:
pointer expected.
Compile
Error
Compile
Error
Compile
Warning
Unclosed comment.
Compile
Error
Undeclared identifier
NAME.
Compile
Error
A-40
Appendix A
Error Message
Type Error
Comment
Compile
Error
Compile
Error
Compile
Error
Compile
Error
Compile
Error
Compile
Error
Undefined static
TYPE NAME.
Compile
Warning or
Error
A-41
Appendix A
Error Message
Type Error
Comment
Link Error
Unexpected #elif;
#endif expected.
Compile
Error
Unexpected #elif;
#if not seen.
Compile
Error
Unexpected #else;
#endif expected.
Compile
Error
Unexpected #else;
#if not seen.
Compile
Error
Unexpected #endif;
no matching #if, #ifdef,
or #ifndef.
Compile
Error
Unexpected EOF.
Load Error
LabWindows/CVI encountered an
unexpected End Of File (EOF) condition
when loading an external object module.
Ensure that the object file has not been
truncated.
Unexpected EOF;
TOKEN expected.
Compile
Error
A-42
Appendix A
Error Message
Type Error
Non-Fatal
Run-time Error
Unexpected token.
Compile
Error
Unexpected trailing
tokens on directive line
ignored.
Compile
Warning
Uninitialized pointer.
Non-Fatal
Run-time Error
Uninitialized pointer
argument to library
function.
Fatal
Run-time Error
Uninitialized string.
Non-Fatal
Run-time Error
Compile
Warning
Unknown enumeration
NAME.
Compile
Error
Compile
Error
A-43
Comment
Appendix A
Error Message
Type Error
Comment
Unknown modifier.
Non-Fatal
Run-time Error
Unknown or unsupported
OMF record at position
NUMBER: OMF record type
NUMBER.
Load Error
Unknown size of
type TYPE.
Compile
Error
Unknown specifier.
Non-Fatal
Run-time Error
Compile
Warning
Unrecognized character
escape sequence.
Compile
Warning
Unrecognized character
escape sequence CHAR.
Compile
Warning
Unrecognized
declaration.
Compile
Error
Unrecognized
preprocessor directive.
Compile
Error
Unrecognized statement.
Compile
Error
A-44
Appendix A
Error Message
Type Error
Comment
Unsigned operand of
unary .
Compile
Warning
Unsupported segment
combination type NUMBER:
segment name NAME.
Load Error
Use of keyword
'__import' contradicts
previous use of keyword
'__export' at POSITION.
Compile
Error
Use of keyword
'__export' contradicts
previous use of keyword
'__import' at POSITION.
Compile
Error
Use of keyword
'__declspec(dllimport)'
contradicts previous
use of keyword
'__declspec(dllexport)'
at POSITION.
Compile
Error
Use of keyword
'__declspec(dllexport)'
contradicts previous
use of keyword
'__declspec(dllimport)'
at POSITION.
Compile
Error
Value parameter
expected.
Non-Fatal
Run-time Error
int __export x;
int __import x=0;
A-45
Appendix A
Error Message
Type Error
Comment
Variables defined as
DLL imports cannot be
defined with an initial
value.
Compile
Error
Fatal
Run-time Error
Fatal
Run-time Error
Non-Fatal
Run-time Error
Warning: Import
libraries other than the
one for the current
compatibility mode may
not work for symbols
exported from an object
file. It is recommended
that you export using
header files instead.
DLL Link
Warning
Watchpoint
Error
Non-Fatal
Run-time Error
z modifier required to
match string parameter.
Non-Fatal
Run-time Error
int __import i = 0;
A-46
Customer Communication
For your convenience, this appendix contains forms to help you gather the information necessary
to help us solve your technical problems and a form you can use to comment on the product
documentation. When you contact us, we need the information on the Technical Support Form and
the configuration form, if your manual contains one, about your system configuration to answer your
questions as quickly as possible.
National Instruments has technical assistance through electronic, fax, and telephone systems to quickly
provide the information you need. Our electronic services include a bulletin board service, an FTP site,
a fax-on-demand system, and e-mail support. If you have a hardware or software problem, first try the
electronic support systems. If the information available on these systems does not answer your
questions, we offer fax and telephone support through our technical support centers, which are staffed
by applications engineers.
Electronic Services
Bulletin Board Support
National Instruments has BBS and FTP sites dedicated for 24-hour support with a collection of files
and documents to answer most common customer questions. From these sites, you can also download
the latest instrument drivers, updates, and example programs. For recorded instructions on how to use
the bulletin board and FTP services and for BBS automated information, call 512 795 6990. You can
access these services at:
United States: 512 794 5422
Up to 14,400 baud, 8 data bits, 1 stop bit, no parity
United Kingdom: 01635 551422
Up to 9,600 baud, 8 data bits, 1 stop bit, no parity
France: 01 48 65 15 59
Up to 9,600 baud, 8 data bits, 1 stop bit, no parity
FTP Support
To access our FTP site, log on to our Internet host, ftp.natinst.com, as anonymous and use
your Internet address, such as [email protected], as your password. The support files and
documents are located in the /support directories.
B-1
Fax-on-Demand Support
Fax-on-Demand is a 24-hour information retrieval system containing a library of documents on a wide
range of technical information. You can access Fax-on-Demand from a touch-tone telephone at
512 418 1111.
Country
Telephone
Fax
Australia
Austria
Belgium
Brazil
Canada (Ontario)
Canada (Quebec)
Denmark
Finland
France
Germany
Hong Kong
Israel
Italy
Japan
Korea
Mexico
Netherlands
Norway
Singapore
Spain
Sweden
Switzerland
Taiwan
United Kingdom
United States
03 9879 5166
0662 45 79 90 0
02 757 00 20
011 288 3336
905 785 0085
514 694 8521
45 76 26 00
09 725 725 11
01 48 14 24 24
089 741 31 30
2645 3186
03 6120092
02 413091
03 5472 2970
02 596 7456
5 520 2635
0348 433466
32 84 84 00
2265886
91 640 0085
08 730 49 70
056 200 51 51
02 377 1200
01635 523545
512 795 8248
03 9879 6277
0662 45 79 90 19
02 757 03 11
011 288 8528
905 785 0086
514 694 4399
45 76 26 02
09 725 725 55
01 48 14 24 14
089 714 60 35
2686 8505
03 6120095
02 41309215
03 5472 2977
02 596 7455
5 520 3282
0348 430673
32 84 86 00
2265887
91 640 0533
08 730 43 70
056 200 51 55
02 737 4644
01635 523154
512 794 5678
B-2
Other Products
Computer make and model ________________________________________________________
Microprocessor __________________________________________________________________
Clock frequency or speed __________________________________________________________
Type of video board installed _______________________________________________________
Operating system version __________________________________________________________
Operating system mode ___________________________________________________________
Programming language ___________________________________________________________
Programming language version _____________________________________________________
Other boards in system ____________________________________________________________
Base I/O address of other boards ____________________________________________________
DMA channels of other boards _____________________________________________________
Interrupt level of other boards ______________________________________________________
Title:
Edition Date:
February 1998
Part Number:
320685D-01
Fax to:
Technical Publications
National Instruments Corporation
512 794 5678
Glossary
Prefix
Meaning
Value
m-
milli-
10
micro-
10
n-
nano-
10
A
active window
API
Array Display
auto-exclusion
B
binary control
breakpoint
Breakpoint
Breakpoint command
G-1
Glossary
C
cdecl
check box
A dialog box item that allows you to toggle between two possible
options.
clipboard
control
cursor
The flashing rectangle that shows where you can enter text on the
screen.
D
default command
The action that takes place when you press <Enter> and did not
specifically select a command. A double outline indicates default
command buttons in dialog boxes.
dialog box
DLL
E
entry mode indicator
excluded code
G-2
Glossary
F
.fp file
A file that contains information about the function tree and function
panels of an instrument module.
function panel
function tree
The window in which you build the skeleton of a function panel file.
It is described in the LabWindows/CVI Instrument Driver
Developers Guide.
G
Generated Code box
A small box located at the bottom of the function panel screen that
displays the function call code that corresponds to the current state
of the function panel controls.
global control
glue code
H
hex
Hexadecimal.
G-3
Glossary
highlight
I
immediate action command
A menu bar item that has no menu items associated with it and causes
a command to execute immediately when you select it. An
immediate action command is suffixed with an exclamation point (!).
input control
A function panel control that accepts a value you type in from the
keyboard. An input control can have a default value associated with
it. This value appears in the control when the panel is first displayed.
input focus
instrument driver
G-4
Glossary
L
list box
lvalue
M
MB
Megabytes of memory.
menu
O
output control
A function panel control that displays a value that the function you
execute generates. An output control parameter must be a string, an
array, or a reference parameter of type integer, long, single-precision,
or double-precision.
ordinal number
P
PASCAL
Project window
prompt command
G-5
Glossary
R
return value control
ring control
rvalue
S
SDK
scroll bars
Areas along the bottom and right sides of a window that show your
relative position in the file. You can use scroll bars can be used to
move about in the window.
select
To choose the item that the next executed action affects by moving
the input focus (highlight) to a particular item or area.
slide control
slider
The cross-bar on the slide control that determines the value placed in
the function call.
Source window
G-6
Glossary
Standard Input/Output
window
standard libraries
stdcall
T
text box
A dialog box item in which you enter text from the keyboard or
view text.
U
User Interface Editor window
V
Variables window
A window that shows the values of the variables that are currently
active.
G-7
Glossary
W
Watch window
window
G-8
Index
Special Characters/Numbers
I-1
Index
C
.c files. See source files.
C language extensions
calling conventions (Windows 95/NT),
1-2 to 1-3
C++-style comment markers, 1-4
duplicate typedefs, 1-4
import and export qualifiers, 1-3 to 1-4
non-ANSI C standard keywords, 1-2
program entry points (Windows), 1-5
structure packing pragma (Windows),
1-4 to 1-5
I-2
Index
data types
allowable data types (table), 1-6
converting 16-bit code to 32-bit
code, 1-6 to 1-7
debugging levels, 1-8
error messages, A-1 to A-46
limits (table), 1-1
non-ANSI C keywords, 1-2
overview, 1-1
user protection errors
general protection errors, 1-11
library protection errors, 1-11 to 1-12
memory corruption (fatal), 1-11
memory deallocation
(non-fatal), 1-11
pointer arithmetic (non-fatal),
1-8 to 1-9
pointer assignment (non-fatal), 1-9
pointer casting (non-fatal), 1-10
pointer comparison (non-fatal), 1-10
pointer dereference errors (fatal),
1-9 to 1-10
pointer subtraction (non-fatal), 1-10
Compiler Defines command, Options menu,
1-2, 3-27
compiler options
compiled object modules
Borland C 4.x, 4-3
Symantec C++ 6.0, 4-3
Watcom, 4-2
setting, 1-2
Compiler Options command, Options
menu, 1-2
compiler/linker issues. See specific operating
system, e.g., UNIX operating system.
configuring Run-time Engine. See Run-time
Engine, configuring.
converting 16-bit source code to 32-bit source
code, 1-6 to 1-7
Create Distribution Kit command, Build
menu, 7-1, 7-9
D
Data Acquisition Library, 9-4
data types
allowable data types for compiler
(table), 1-6
converting 16-bit source code to 32-bit
source code, 1-6 to 1-7
DDE Library, 9-6
debugging levels
Extended, 1-8
setting, 1-8
Standard, 1-8
__declspec(dllexport) qualifier, 1-3, 3-22
__declspec(dllimport) qualifier, 1-3
distributing libraries, 8-1 to 8-3
adding to users Library menu, 8-1 to 8-2
specifying library dependencies,
8-2 to 8-3
I-3
Index
status codes
checking function call status
codes, 9-1
returned by LabWindows/CVI
functions, 9-2 to 9-3
status reporting by libraries and
instrument drivers, 9-3 to 9-7
errors. See also user protection errors.
compiler-related error messages,
A-1 to A-46
events, multiplatform application
considerations, 6-3
executable file, required for standalone
executables, 7-8
executables, creating and distributing. See
standalone executables, creating and
distributing.
export qualifiers
_export, 1-3
__export, 1-3, 3-22
exporting DLL functions and
variables, 3-22
purpose and use, 1-3 to 1-4
External Compiler Support command, Build
menu, 3-11, 3-13
external modules. See also loadable compiled
modules.
definition, 2-4
forcing referenced modules into
executable or DLL, 7-15
multiplatform application
considerations, 6-3
under UNIX
compiling with external compilers,
5-6 to 5-7
restrictions, 5-6
using loadable compiled module as, 2-4
E
Easy I/O for DAQ Library, 9-4
Edit menu
Function Tree Editor, 8-2
Source, Interactive Execution, and
Standard Input/Output windows, 3-3
electronic support services, B-1 to B-2
e-mail support, B-2
enum sizes, Windows 32-bit DLLs, 3-7
error checking, 9-1 to 9-7
Break on Library Errors option, 1-12,
7-19, 9-1
overview, 9-1
standalone executables, 7-19
I-4
Index
H
hardware interrupts under
Windows 95/NT, 3-29
hot keys, multiplatform application
considerations, 6-3
I
image files
accessing from standalone
executables, 7-12
multiplatform application
considerations, 6-3
using with standalone executables, 7-9
import libraries (Windows 95/NT)
automatic loading of SDK import
libraries, 3-27 to 3-28
compatibility with external compilers, 3-5
customizing DLL import libraries,
3-20 to 3-21
I-5
Index
L
LabWindows/CVI compiler. See compiler.
LabWindows/CVI Run-time Engine. See
Run-time Engine.
.lib files. See library files.
libraries
C library issues, 1-5
creating static libraries, 3-25
distributing, 8-1 to 8-3
adding to users Library menu,
8-1 to 8-2
specifying library dependencies,
8-2 to 8-3
loading library files for standalone
executables, 7-16
portability issues for multiplatform
applications, 6-1 to 6-2
using loadable compiled modules as user
libraries, 2-3
Windows 95/NT compiler issues
calling InitCVIRTE and
CloseCVIRTE, 3-14 to 3-15
include files for ANSI C library and
LabWindows/CVI libraries, 3-10
multithreading and
LabWindows/CVI libraries, 3-8
resolving callback references from
.uir files, 3-10 to 3-12
resolving references from modules
loaded at run-time, 3-12
standard input/output windows, 3-10
using LabWindows/CVI libraries in
external compilers, 3-9 to 3-15
I-6
Index
library files
compatibility with external compilers
(Windows 95/NT), 3-5
creating in external compilers for use in
LabWindows/CVI, 3-18 to 3-19
loading with LoadExternalModule, 7-16
using with standalone executables, 7-9
library function user protection errors, 1-16
disabling, 1-13 to 1-14
Library menu
appearance of user libraries on, 2-3
installing user libraries, 2-3, 8-1 to 8-2
linking modules with external
modules, 7-15
Library Options command, Project Options
menu, 2-3, 8-1
library protection errors, 1-11 to 1-12
disabling
for functions, 1-13 to 1-14
at run-time, 1-12
errors involving library protection,
1-11 to 1-12
loadable compiled modules
16-bit Windows DLLs
creating
with Borland C++, 4-22
with Microsoft Visual C++ 1.5,
4-21 to 4-22
glue code
DLLs unable to use glue code
generated at load time,
4-8 to 4-20
DLLs using glue code generated
at load time, 4-8
requirements, 4-7
helpful LabWindows/CVI
options, 4-4
overview, 4-3 to 4-4
rules and restrictions, 4-5 to 4-7
search precedence, 4-23 to 4-24
I-7
Index
multithreading
creating multiple threads with Windows
SDK functions, 3-27
using LabWindows/CVI libraries, 3-8
N
_NI_mswin_ macro, 6-1
_NI_mswin16_ macro, 6-1
_NI_mswin32_ macro
multiplatform programming, 6-1
required for external compilers, 3-8
_NI_sparc_ macro, 6-1
_NI_unix_ macro, 6-1
M
macros, predefined, 6-1
manual. See documentation.
math coprocessor software emulation for
Windows 3.1, 7-2
memory protection errors
memory corruption (fatal), 1-11
memory deallocation (non-fatal), 1-11
message file for Run-time Engine
translating, 7-5
Windows 95/NT, 7-11
messages passed from DLLs. See Windows
messages passed from DLLs.
Microsoft Visual Basic, automatic inclusion of
Type Library resource for, 3-24 to 3-25
Microsoft Visual C/C++
creating 16-bit Windows DLLs,
4-21 to 4-22
creating object and library files, 3-18
default library directives, 3-16
minimum system requirements for standalone
executables, 7-1 to 7-2
missing return value (non-fatal) error, 1-11
modini program (caution), 8-2, 8-3
modreg program (caution), 8-2, 8-3
multiplatform applications, building
externally compiled module issues, 6-3
library portability issues, 6-1 to 6-2
predefined macros, 6-1
programming guidelines, 6-1 to 6-3
user interface guidelines, 6-3
O
.o files
loading with LoadExternalModule, 7-14
using with standalone executables, 7-9
object files
compatibility with external compilers
(Windows 95/NT), 3-5
creating
in external compilers for use in
LabWindows/CVI, 3-18 to 3-19
in LabWindows/CVI, 3-26
loading with LoadExternalModule, 7-14
using with standalone executables, 7-9
Options menu
Function Tree Editor, Generate Windows
Help command, 3-25
Project window
Compiler Defines command,
1-2, 3-27
Compiler Options command, 1-2
Include Paths command, 1-17, 3-28
Instrument Directories
command, 8-2
Run Options command, 1-8,
1-12, 1-16
I-8
Index
pointers
DLLs passing pointers that point to other
pointers, 4-18 to 4-20
returned by DLLs, 4-15 to 4-17
pragmas
disabling or enabling library protection
errors, 1-13 to 1-14
structure packing (Windows),
1-4 to 1-5, 3-6
predefined macros, 6-1
printf function
LabWindows/CVI implementation, 5-4
using with external compiler, 3-10
process segments, locking into memory using
plock(), 5-7
program entry points (Windows), 1-5
Project window, Run Options menu, 4-4
projects. See also source files.
loadable compiled modules in project list,
2-3 to 2-4
loading project files with
LoadExternalModule, 7-15 to 7-16
.pth files
loading with LoadExternalModule,
7-17 to 7-18
not supported for Windows 95/NT, 3-2
using with standalone executables, 7-9
P
pack pragma (Windows), 1-4 to 1-5, 3-6
panel state files
accessing from standalone
executables, 7-12
required for standalone executables, 7-9
pascal, Pascal, and _pascal keywords, 1-2
Pascal DLL functions, 4-8, 4-9
path files. See .pth files.
PCX files, multiplatform application
considerations, 6-3
platform-independent applications, building.
See multiplatform applications, building.
plock function, UNIX, 5-7
pointer casting, 1-14
pointer protection errors, 1-8 to 1-10
disabling for individual pointers,
1-12 to 1-13
dynamic memory protection errors, 1-11
pointer arithmetic (non-fatal), 1-8 to 1-9
pointer assignment (non-fatal), 1-9
pointer casting (non-fatal), 1-10
pointer comparison (non-fatal), 1-10
pointer dereference errors (fatal),
1-9 to 1-10
pointer subtraction (non-fatal), 1-10
Q
Q387 coprocessor emulation software
(Quickware), 7-2
R
references, resolving. See callback references,
resolving (Windows 95/NT).
RegisterWinMsgCallback function, 4-21
Reload DLLs Before Each Run option, 4-4
resolving references. See callback references,
resolving.
I-9
Index
system requirements
Windows 3.1, 7-2
Windows 95/NT, 7-1 to 7-2
translating message file, 7-5
S
scanf function
LabWindows/CVI implementation, 5-4
using with external compiler, 3-10
SDK functions. See Windows SDK functions.
search precedence of Windows DLLs,
4-23 to 4-24
shared libraries, under UNIX, 5-2
shortcut keys, multiplatform application
considerations, 6-3
SIGBUS signal, 5-7
SIGFPE signal, 5-7
SIGILL signal, 5-7
SIGINT signal, 5-7
SIGPIPE signal, 5-7
SIGPOLL (SIGIO) signal, 5-7
SIGQUIT signal, 5-7
SIGSEGV signal, 5-7
SIGTERM signal, 5-7
Solaris. See Sun Solaris.
source files
converting 16-bit source code to 32-bit
source code, 1-6 to 1-7
loading with LoadExternalModule, 7-18
preparing for use in Windows 32-bit DLL,
3-21 to 3-24
calling conventions for exported
functions, 3-21 to 3-22
exporting DLL functions and
variables, 3-22
export qualifier method,
3-22 to 3-23
include file method, 3-22
I-10
Index
I-11
Index
Sun Solaris
distribution of standalone executables
LabWindows/CVI Run-Time Engine
files, 7-12
Solaris 1, 7-4 to 7-5
Solaris 1 patches required, 7-5 to 7-6
Solaris 2, 7-3 to 7-4
incompatibilities with
LabWindows/CVI, 5-11
support modules for glue code, 4-9
Symantec C/C++
creating object and library files, 3-19
default directives, 3-16
Symantec or Borland 32-bit compiled
modules under Windows, 4-2 to 4-3
T
Target command, Build menu, 3-20,
3-21, 3-25
TCP Library, 9-6
technical support, B-1 to B-2
telephone and fax support numbers, B-2
Type Library resource for Visual Basic,
3-24 to 3-25
typedefs, duplicate, 1-4
U
.uir files. See user interface resource
(.uir) files.
unions, 1-16
UNIX C library. See Sun C library.
UNIX compiler/linker issues, 5-1 to 5-11
asynchronous signal handling, 5-7 to 5-8
calling Sun C library functions, 5-1
restrictions, 5-1
creating executables, 5-3 to 5-5
compatible external compilers, 5-3
InitCVIRTE called by main function,
5-4 to 5-5
I-12
Index
I-13
Index
V
va_arg (ap, type), 1-2
VISA Library, 9-5
Visual Basic. See Microsoft Visual Basic.
Visual C/C++. See Microsoft Visual C/C++.
VXI Library, 9-4
W
Watcom C/C++
32-bit compiled modules under
Windows 3.1, 4-1 to 4-2
creating object and library files, 3-19
default directives, 3-16
pull-in references, 3-17
stack based calling convention, 3-15
Watcom WEMU387.386 coprocessor
emulation software, 7-2
Windows 3.1
compiler/linker issues
16-bit Windows DLLs. See Windows
16-bit DLLs.
32-bit Borland or Symantec
compiled modules, 4-2 to 4-3
32-bit Watcom compiled modules,
4-1 to 4-2
modules compiled by
LabWindows/CVI, 4-1
cvirtx option for configuring Run-time
Engine, 7-6
distributing standalone executables
math coprocessor software
emulation, 7-2
minimum system requirements, 7-2
structure packing pragmas, 1-4 to 1-5
I-14
Index
I-15
Index
I-16
Index
X
X Property Library, status reporting by, 9-6
I-17