Great Dynamik, it seems to work also for typedefs as long as they are manually opened! For some reason I thought I cannot open reference to a typedef, only VIs.
The reason I need this that there are C libraries, where there has been defined constant values using #define directives and macros. The names of these constants stays the same from version to another but the way they are implemented and even the values may change from library version to another. Also there is no easy way to get the value for compile time macros. I need a way to transform these constant values into a Labview enum. If I make a typedef with the correct strings (and values) for each library version, I can plase this typedef as a control to the labview port of the library functions and pass the typedef value to corresponding version of the library DLL.
When I would like to change into a new version of the library, I can run a small labview program that would call a small C program to get the correct values for each constant, enum etc and write these values to corresponding Labview typedefs. Then I can just replace the old DLL with a new version and everything should go smoothly. The other alternative would be to do the translation from Labview enum values to C constant values at runtime, but this is not something I like as I need high performance in my applications.
An example: Need to transform the following C code to Labview ring.
/* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */
#define H5F_OBJ_FILE (0x0001u) /* File objects */
#define H5F_OBJ_DATASET (0x0002u) /* Dataset objects */
#define H5F_OBJ_GROUP (0x0004u) /* Group objects */
#define H5F_OBJ_DATATYPE (0x0008u) /* Named datatype objects */
#define H5F_OBJ_ATTR (0x0010u) /* Attribute objects */
#define H5F_OBJ_ALL (H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR)
#define H5F_OBJ_LOCAL (0x0020u) /* Restrict search to objects opened through current file ID */
Especially the second last one is the hard one. I was thinking of writing a C utility to which I can pass constant name and it would return the constant value. Then I would call this utility from labview to set the corresponding typedef ring values. Voilá, everything should then work.
--
Tomi Maila