From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling structure in dll

I am trying to call a dll that contains a nested structure. I am not a c-programmer so therefore I
would lik to use the call library function but I do not know how to handle the union structure shown below??


Function Name:
cnc_rdparam

Declaration:
FWLIBAPI short WINAPI cnc_rdparam(unsigned short FlibHndl,short number,short axis,short length,IODBPSD *param);


typedef struct iodbpsd {
short datano ; /* data number */
short type ; /* axis number */
union {
char cdata ;/* parameter / setting data */
short idata ;
long ldata ;
char cdatas[MAX_AXIS] ;
short idatas[MAX_AXIS] ;
long ldatas[MAX_AXIS] ;
} u ;
0 Kudos
Message 1 of 2
(2,434 Views)
I'm not sure, but I think that you have to wire the "param" output of "Call library function" to the cluster which consists of
1. datano - I16
2. type - I16
3. the variable with type depending on the type of union - I8 for cdata, 116 for idata, I32 - for ldata, array of I8 for cdatas, array of I16 for idatas, array of I32 for ldatas.
In other words you must know the type of cluster before calling of this function. May be this type depends on values of other parameters.
I think that you have to organize the case structure in your diagram which calls this function and returns the appropriate cluster depending on other parameters.

Oleg Chutko.
0 Kudos
Message 2 of 2
(2,433 Views)