10-02-2015 07:42 AM
Hi,
I am currently trying to unbundle a C structure.
The normal create a cluster witht he same items as the struc works, but the sturcture might be subjected to changes and that would brake my programm.
is there a way to call the elements by name?
Solved! Go to Solution.
10-02-2015 07:47 AM
You have a cluster in LabVIEW now? Look at Unbundle by Name to pull things out of that cluster by name.
10-02-2015 07:52 AM
i did think of that but it didnt work
10-02-2015 09:27 AM
10-02-2015 09:33 AM
You're calling a C function and that returns a struct, correct?
You think that the struct could change and you will need to handle that, correct?
The obvious answer is to update the code. Make the cluster a typedef and modify it manually when you get a new DLL which has the new version of the struct.
If for some reason that is not possible, you can also pass in an array of bytes (1D U8) of the correct size, let the C function fill up the values of those bytes and then read the relevant bytes from the array and convert them to the specific data you want. This will require you to understand both how LV stores data, how C stores data, how alignment works and be familar with the data conversion option in LV, like type casting and byte swapping. It will also be more brittle, so I would suggest going with the first option.
10-05-2015 03:17 AM
Not the answer i had hoped to hear but thank you guys
10-05-2015 08:18 AM