NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass a CVI struct containing an enumerated type to TestStand?

Solved!
Go to solution

Hi,

 

I have a CVI struct that contains an enumerated type.  I want to call a CVI function with this struct as an argument from TestStand.  I created a similar struct (container type) in TestStand, and the other fields in the struct seem to be passed to CVI from TestStand ok, but the enum field is always zero.  Any idea what I can do?  I don't want to change the CVI enum and struct definitions.

 

Example:

 

typedef enum eOption {OPTION_A = 0, OPTION_B = 1}  Option;

typedef struct stMyStruct {

double a;

int b;

Option c;

} MyStruct;

 

Thanks!

0 Kudos
Message 1 of 3
(3,471 Views)

Are you using a dll? Assuming so, my thoughts follow:

 

Which versions fo CVI and TestStand do you have?  Have you created an fp file for the functions that you're exporting in your dll?  The problem you're experiencing may have something to do with the behavior that's explained in this Knowledge Base article:

 

TestStand and LabWindows/CVI Enumeration Data Types

 

 Please follow that Knowledge Base article to create an fp file for your dll.  Let us know if that works.


Mark E.
National Instruments

0 Kudos
Message 2 of 3
(3,445 Views)
Solution
Accepted by topic author WillyC

As it turns out, my TestStand container type definition didn't exactly match the CVI struct, in terms of memory sizes of the fields.  Once I fixed the TestStand container defintion to make the memory packing exactly match my CVI struct, the enum field was passed just fine (I defined the enum field as a signed 32-bit integer in the TestStand container properties).  I didn't need to create an fp or a type library for my CVI dll.

 

Thanks!

0 Kudos
Message 3 of 3
(3,434 Views)