05-13-2022 12:27 PM
I am having issues getting the proper data type when importing this function from my .so.
I am running LabView 64 bit, in oracle linux.
I expect to import this function and need to pass it 3 arrays (label, units, and value), and a number (num_variables).
Instead, I get a string type for, label and units, and a numerical double type for value.
Attached is the c code for the function.
05-14-2022 03:26 PM
That's one hairy function interface for sure:
You will likely have to do following but I have to admit that I'm not 100% that the label, units and text_value actually will work like that. I never did 2D arrays like that.
first parameter: numeric, signed 16 bit integer passed by value
second parameter: You need to create a string with num_variables * LEN_LONG_LABEL characters and you need to place the names of each variable at a multiple of LEN_LONG_LABEL characters in that string, fill the rest in between with whatever you like but make sure that there is at least one \00 character directly after each label. You can then pass this as a C string pointer. Alternatingly you could also convert it to a byte array and pass it as Array Data Pointer of U8.
third parameter: Create an array of doubles with the length num_variables and pass it as Array Data Pointer.
fourth and fifth parameter: do the same as for the second parameter but with num_variables * LEN_UNITS and num_variables * LEN_STRING_VARIABLE characters. And here you MUST convert it to a byte array and pass it to the function as an Array Data Pointer. If you pass it as a string, LabVIEW will scan the string after the function returns for the first \00 character and then resize the string to that, effectively cutting away all the strings beyond the first element in that array.
If you pass it as byte array, LabVIEW will not do anything like that but you will then have to convert it into a string yourself and then go through it at multiples of LEN_UNITS and LEN_STRING_VARIABLE characters respectively and find the terminating \00 character after that to find out what part of the string you have to get the subset from.