NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a struct from TestStand to LabWindows/CVI

Solved!
Go to solution

I am passing a struct to a dll written in CVI.

 

Here is the problem: The code is written in CVI (c code) if I use "struct MyStruct *MyData" as the parameter definition in the dll TestStand works fine. But if I define my struct using a typedef (i.e. typdef struct MyStruct) then use MyStruct *MyData as the parameter TestStand throws a warning. 

 

I an using the C\C++ adaptor.

It is too late in the programming effort to go back and remove the typedef.

 

So, how do I get TestStand to accept the typedef?

 

Thanks

Carmine

0 Kudos
Message 1 of 3
(3,431 Views)
Solution
Accepted by topic author CarmineS

In ANSI C, the struct names and type names belong to separate namespaces. You can declare structs several different ways:

 

1) struct structName { int x; };

2) typedef struct { int x; } typedefName;

3) typedef struct structName { int x; } typedefName; // Note: structName can be same as typedefName.

 

I'm assuming you are using the 2nd example above in which case LabWindows/CVI automatically generates a struct name (something like __unknown_1) that Testand uses.

 

Although you said it is too late to remove the typedef, can you add a struct name as in example 3 above? You can use the same name as the typedefName and TestStand will recognize it.

Message 2 of 3
(3,400 Views)

Thanks a lot. I made the modification to the struct definition and it is working.

 

Erik,

 

Thanks for the quick reply.

 

Carmine

 

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