LabWindows/CVI

Content Type
Programming Language
Current manual

InitCVIRTE

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 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.
  • 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 * 0 if called from main.

hInstance if called from WinMain, first parameter.
hInstDLL if called from DllMain, first parameter.
argv char *[] argv if called from main, second parameter. Otherwise, 0.
reserved void * Reserved for future use. Pass 0.

Return Value

Name Type Description
status int 1 = success

0 = failure, probably out of memory

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Example

Refer to dll\basic\cvidll.cws for an example of using the InitCVIRTE function.

Was this information helpful?