07-15-2019 10:20 AM
I hope Someone can help me because I've been struggling with that for at lease 2 weeks.
I'm using LabVIEW linux with CentOS 7. trying to access and USB-1408FS-Plus (DAQ) from Measurement computing.
I've got the ".so" and ".h" header files but when I try to use the wizard for building the functions it doesn't quite work. So I just thought of making the function manually by entering the parameters.
The function in C is:
UlError ulGetDaqDeviceInventory(DaqDeviceInterface interfaceTypes, DaqDeviceDescriptor daqDevDescriptors[], unsigned int* numDescriptors)
UlError is an ENUM
InterfaceTypes is an ENUM
DaqDeviceDescriptor is a type:
struct DaqDeviceDescriptor
{
char productName[64];
unsigned int productId;
DaqDeviceInterface devInterface;
char devString[64];
char uniqueId[64];
char reserved[512];.
};
typedef struct DaqDeviceDescriptor DaqDeviceDescriptor;
so I decided to create in LabVIEW a cluster that included an byte Array (ProductName), a U32 integer for ProductID and so on
but I think it doesn't like that from I a read on the web shared library doesn't like passing a structure type if it contains an array.
some seemed to say that I need to replace my array of byte by a pointer. How do I do that?
any idea?
Thanks in advance
07-18-2019 02:31 PM
You need to replace the fixed-length arrays with LabVIEW clusters containing the same number of elements of the correct type. So, if you have a cluster representing a DaqDeviceDescriptor, it should contain as elements:
a cluster of 64 U8 for productName
a U32 (probably) for productId
a cluster of 64 U8 for devString
a cluster of 64 U8 for uniqueId
and something containing 512 bytes for reserved. I think the maximum number of elements in a cluster is 256, and anyway large clusters are unwieldy, so probably easier to make that a cluster containing 64 U64 elements.
Alternatively, you can create an array of 64 + 4 + 64 + 64 + 512 = 708 bytes and pass that, then parse out the portions you want afterwards.
If you need more assistance, please attach:
- screenshots or snippets of your code, so we can see what's happening without loading LabVIEW (or in case we're working in an older version than you are)
- your actual code, if you don't provide a snippet
- documentation on the functions you're trying to call and the data types you're using