LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure call library function node for dll function with struct consist of char[6]

I have this function:

DLL_EXPORT unsigned long OpenInt(void ** ppHandle, DeviceInfo * pDevice);

device info is defined as:

struct DeviceInfo
{
       unsigned long c_port;
       unsigned long type;           
       unsigned long device_ver1
       unsigned long device_ver2;
       unsigned char device_serial[6];
};

My question is how can i configure call library function note for the function to work properly?

My Idea is to create cluster with 4 uint32s but how to pass char device_serial[6] to dll? Should I use array with 6 elements of a type uint8 ?

 

0 Kudos
Message 1 of 2
(1,784 Views)

An array will pass a pointer to it, so that won't work. Same for a string.

 

I'd try (for the char[6]) a cluster with 6 bytes. So you'll have a cluster with 4 U32s and a cluster of 6 bytes.

 

You can also make a cluster with 6 U32s. The last two bytes of the last U32 won't be used, but won't hurt.

 

In fact, you could simply pass an array of bytes. 4X4+6=22 should do. LV will pass a pointer to the data, and the dll will be happy.

 

0 Kudos
Message 2 of 2
(1,770 Views)