LabWindows/CVI

Library Functions

The LabWindows/CVI library functions that take pointer arguments or that return pointers incorporate run-time checking for those arguments and return values. However, you must be careful when passing arguments to library functions that have void * parameters, such as GetCtrlAttribute and GetCtrlVal in the User Interface Library and memcpy and memset in the ANSI C Library. If you use a void * cast when you pass an argument to a function that expects a variably typed argument, you disable run-time type checking for that argument. For example, if you pass (void *)&myFloat, the LabWindows/CVI compiler knows that you are passing a pointer to four bytes of data, but it does not know that these four bytes represent a floating-point number as opposed to an integer or a pointer. The following examples illustrate this concept:

{

float myFloat;
GetCtrlVal(panel, ctrl, &myFloat); /* CORRECT */
GetCtrlVal(panel, ctrl, (void *)&myFloat); /* INCORRECT */

}

{

char *names[N], *namesCopy[N];
memcpy(namesCopy, names, sizeof (names)); /* CORRECT */
memcpy((void *)namesCopy, (void *)names, sizeof names); /* INCORRECT */

}