02-24-2012 03:08 PM
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
Solved! Go to Solution.
02-27-2012 09:59 AM
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.
02-28-2012 03:28 PM
Thanks a lot. I made the modification to the struct definition and it is working.
Erik,
Thanks for the quick reply.
Carmine