National Instruments 320685D-01 ユーザーズマニュアル

ページ / 211
Chapter 3
Windows 95/NT Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual
3-14
©
 National Instruments Corporation
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.
Calling InitCVIRTE and CloseCVIRTE 
If you link an executable or DLL in an external compiler, you must call the 
InitCVIRTE
 
function at the beginning of your 
main
WinMain
, or 
DLLMain
 function. 
For an executable using 
main
 as the entry point, your code must include the following 
segment:
#include <cvirte.h>
int main (argc, char *argv[])
{
if (InitCVIRTE(0, argv, 0) == 0)
return (-1);/* out of memory   */
/* your other code */
}
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 */
}
00ProRef.book : 06chap03.fm  Page 14  Monday, March 9, 1998  3:23 PM