InitCVIRTE

int InitCVIRTE (void *hInstance, char *argv[], void *reserved);

Purpose

Performs initialization of the LabWindows/CVI Run-time Engine. You need InitCVIRTE only in executables or DLLs that you link using an external compilerexternal compiler. Otherwise, the function is harmless.

Linux You must callmust call InitCVIRTE to initialize the libraries from the executable.

Call InitCVIRTE in your main, WinMain, or DllMain function. Which of these three functions you use determines the parameter values you pass to InitCVIRTE. The following examples show how to use InitCVIRTE in each case:

int main (int argc, char *argv[])
{

if (InitCVIRTE (0, argv, 0) == 0)

return -1; /* out of memory */

/* your other code */
return 0;

}

  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 */
return 0;

}

  int __stdcall DllMain (void *hinstDLL, int fdwReason, void *lpvReserved)

{

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    The prototypes for InitCVIRTE and CloseCVIRTE are in cvirte.h, which is included by utility.h.
Note   In LabWindows/CVI 4.0.1, the number of parameters to this function increased from one to three. Executables and DLLs created using just one parameter will continue to work.

Parameters

Input
Name Type Description
hInstance void pointer 0 if called from main.

hInstance if called from WinMain, first parameter.
hInstDLL if called from DllMain, first parameter.

argv string array argv if called from main, second parameter. Otherwise, 0.
reserved void pointer Reserved for future use. Pass 0.

Return Value

Name Type Description
status integer 1 = success

0 = failure, probably out of memory