From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

configuring dll when parameter is of STRUCT type

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(2,604 Views)

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.

0 Kudos
Message 2 of 6
(2,597 Views)

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?

 

 

0 Kudos
Message 3 of 6
(2,581 Views)
Solution
Accepted by topic author raju_1

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.

0 Kudos
Message 4 of 6
(2,577 Views)

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.

 

0 Kudos
Message 5 of 6
(2,573 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(2,569 Views)