Chapter 1 LabWindows/CVI Compiler
©
National Instruments Corporation 1-3 LabWindows/CVI Programmer Reference Manual
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, Windows95/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
Watco m.
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.
Import and Export Qualifiers
You can use the following qualifiers in variable and function declarations:
__declspec(dllimport)
__declspec(dllexport)
__import
__export
_import
_export

00ProRef.book : 06chap01.fm Page 3 Monday, March 9, 1998 3:23 PM