Chapter 3 Windows 95/NT Compiler/Linker Issues
©
National Instruments Corporation 3-7 LabWindows/CVI Programmer Reference Manual
Returning Floats and Doubles
The compilers return float and double scalar values using different mechanisms. This is
true of all calling conventions, including
__stdcall. The only solution for this problem is
to change your DLL API so that it uses output parameters instead of return values for
double
and
float scalars.
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.
Differences between LabWindows/CVI and the External Compilers
LabWindows/CVI does not work with all the non-ANSI extensions each external compiler
provides. Also, in cases where ANSI does not specify the exact implementation,
LabWindows/CVI does not always agree with the external compilers. Most of these
differences are obscure and rarely encountered. The following are the most important
differences you might encounter:
•
wchart_t is only one-byte in LabWindows/CVI.
• 64-bit integers do not exist in LabWindows/CVI.
•
long double values are 10 bytes in Borland C/C++ but 8 bytes in LabWindows/CVI.
• You cannot use structured exception handling 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.
• LabWindows/CVI does not define
_MSC_VER, __BORLANDC__, __WATCOMC__, and
__SC__. The external compilers each define one of these macros. If you port code
00ProRef.book : 06chap03.fm Page 7 Monday, March 9, 1998 3:23 PM