06-15-2017 03:44 PM
The question I have is fairly generic so I will keep my example the same way.
Lets say I have a dll with the following function (exclude all the dll export stuff):
For the sake of this discussion lets assume that the import shared library wizard works properly and the function vi works as expected.
I mainly live in the C/C++ world so I know that I would need to created the memory this this item before calling the function. Such as:
Or
just passing by reference:
Being new to LabView it is not obviously clear as to how this memory gets allocated.
Since this is an "in/out" I have three options:
With all that said the function seems to work. Even with multiple instances I have not seen any issues; however, it seems a bit weird to me.
In summary, does LabView allocate the memory of an In/Out pointer when passing through a shared library node? Is it true for all primitive data types? Including structures of primitive data types? Specifically ones with defined size (i.e. not dynamic arrays int[])
Solved! Go to Solution.
06-15-2017 03:53 PM - edited 06-15-2017 03:53 PM
@Mitch9192 wrote:
Only consume what comes out. This is the case I am interested in. Does LabView allocate this memory or do I need to do it?
In summary, does LabView allocate the memory of an In/Out pointer when passing through a shared library node? Is it true for all primitive data types? Including structures of primitive data types? Specifically ones with defined size (i.e. not dynamic arrays int[])
For any fixed-size type (a basic type such as an integer, or a cluster of them) LabVIEW will allocate the memory for you because it knows how large the data is. For an array or a string, you need either to allocate the memory yourself (for example, with Initialize Array) or set the minimum array size in the Call Library Function Node configuration.