06-01-2012 10:13 AM
Hi All,
i am using call library funtion to link to one of the DLL but my issue is one of the parameter to be passed is of STRUCT type and i am not sure how to configure this function.
Solved! Go to Solution.
06-01-2012 01:20 PM
Use a cluster that matches the contents of your struct. You may need to add some dummy elements of the cluster for padding. If you post the function prototype and the struct definition it will be easier to provide more specific advice.
06-04-2012 12:24 AM
thanks for the response !!
but what do i select the type while configuring that parameter becuse currently i get only ( numeric,string, match to the type) options, as of now i am selecting match to the type option ,i belive it is correct?
06-04-2012 12:53 AM
If you are passing the struct by reference, then yes, choose Adapt to Type. It does not matter what you choose for "Data format" because clusters are always passed by reference. If you are passing the struct by value, then pass each element of the struct as a separate parameter without using a cluster, as described here.
06-04-2012 01:19 AM
thanks this clarifies my question !!
i juat have one more question on programming practice for handeling constants while linking to DLL's, see if you can awnser it.
for example below is the function given in DLL documentation:
#include <XXX_lib.h>
int port_create(int FLAG);
flag contains the port type and options for the port. The following constants are or'ed into the port
flags:
AFDX_RX_SAMPLING
AFDX_RX_QUEUING
AFDX_RX_SAP
AFDX_TX_SAMPLING
AFDX_TX_QUEUING
AFDX_TX_SAP
so now how do implement thisin labview after configuring:
1. to search these constants in XXX_lib.h and use the value of it instead of these logical names.
2.or is there any way i can pass these logical names so that i dont have to worry about the searching for the values.
06-04-2012 05:33 AM - edited 06-04-2012 05:33 AM
Yes you have to look at the numerics in the header at least once.
If the numeric values of these constants are continously increasing (without gaps) and start at 0, use a LabVIEW enum, otherwise use a LabVIEW Ring Control and save either of them as custom control.