Chapter 4 Windows 3.1 Compiler/Linker Issues
©
National Instruments Corporation 4-3 LabWindows/CVI Programmer Reference Manual
• 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.
•
wchar_t is defined as a char in CVI, whereas it is defined as a short in Borland,
so ANSI C library functions that return
wchar_t or take wchar_t parameters do
not work.
Use the following options when you compile with Borland C 4.x:
• Set the target to be a Win32 application.
•Define
_NI_mswin16_.
• Set the include directories to point to
cvi\include before other include directories.
• Turn off the Allocate Enums as Ints option.
• Turn off the Fast Floating Point option.
• Use the C calling convention.
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:
• Set the target to be a Win32s executable.
• Define
_NI_mswin16_.
• Set the include directories to point to cvi\include before any other include directories.
• Set Structure Alignment to 1 byte.
• Turn off the Use Pascal Calling Convention option.
16-Bit Windows DLLs
You can call functions in a 16-bit DLL from source code or from a 32-bit compiled module.
You can compile your 16-bit DLL in any language using any compiler that generates DLLs.
If you want to program with DMA or interrupts, or access the Windows API, you must use a
Windows DLL.
00ProRef.book : 06chap04.fm Page 3 Monday, March 9, 1998 3:23 PM