NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL global data

I have the following application that is causing a problem.
 
VXI Instrument driver "inst_32.dll" that contains a global data structure.
 
Application dll that calls the VXI instrument driver "apps.dll".  The application dll functions require the session handle to be passed as a parameter and calls the inst_32.dll functions.
 
I created a CVI executable that performs the following
 
main() {
  /* get session handle from inst_32.dll */
  inst_init(&vi);
 
 /* call function "foo" in apps.dll, function "foo" then calls function "bar" in inst_32.dll */
foo(vi);
 
return;
}
 
Function "bar" gets data from the global structure in the inst_32.dll.
 
When I run this in CVI everything works.
 
In TestStand the following sequence does not work;
 
Step 1. Call inst_init to get session handle.
Step 2. Call foo passing the session handle from step 1.
 
Each step seems to have its own seperate instance of the "inst_32.dll" global data structure.
 
Why does this work in CVI and not in TestStand?
 
 
 

Message Edited by hockyhubby on 07-12-2005 10:46 AM

0 Kudos
Message 1 of 2
(2,819 Views)
What is the unload option set to on your dll steps? The load and unload options of steps determines how long your dll code module will stay in memory. If your dll gets unloaded after each step then the global data will be recreated and reinitialized each time your dll is reloaded. The easiest way to fix that is to make sure your unload options are unload when execution completes or something similar (which is the default). If you are running multiple executions though (i.e. interactive executions) and you want the global data to persist then you will need to set the unload option to something like Unload when sequence file's unload.

Hope that helps,
-Doug
0 Kudos
Message 2 of 2
(2,800 Views)