Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How to Use Hook Pointers in LabWindows/CVI Test Executive Functions

Primary Software: LabWindows/CVI Add-ons>>Test Executive
Primary Software Version: 1.1
Primary Software Fixed Version: N/A
Secondary Software:

Problem: How do I use the hook pointer in LabWindows/CVI Test Executive functions?

Solution: All of the test functions in CVI use two common structures: tTestData and tTestError. Within the TestData structure is a member called hook. You can use hook as a pointer to user-defined data. This can be used to pass data from one test function to another without making the data global.

From within the function which has the data to pass, you can type:
data->hook = malloc(sizeof(int));
*(int*)data->hook = 3;
data->hookSize = sizeof(int);
TX_SetEngineAttribute (TXATTR_HOOK_PTR, data->hook);
TX_SetEngineAttribute (TXATTR_HOOK_SIZE, data->hookSize);

You access this value in the target function through:
*((int *)(data->hook))

You can print it:
printf ( "The Value of hook is %d \n", *(int*)data->hook);

***This cannot be used in pre-sequence tests as these have some clean-up which will lose the data contained in hook.****

Related Links:

Attachments:





Report Date: 01/09/1997
Last Updated: 08/30/2001
Document ID: 0T8BS252

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit