05-07-2022 02:24 AM
I need to develop a DLL file for LabVIEW project, written in C++. The array interface of DLL needs to adapt to the array format of "array handle" in LabVIEW "calling library function node".
According to the official description, "data handle" corresponds to the secondary pointer(**) in C language, but how to create a data format in the secondary pointer that conforms to the calling rules of LabVIEW "calling library function node", so as to transfer a one-dimensional / two-dimensional array? Is there any official DLL development example?
Thanks for your teaching.
05-07-2022 04:57 AM - edited 05-07-2022 05:00 AM
Try to configure a Call Library Node with the parameter supposed to pass the array configured as Adapt to Type, connect your array to it and now comes the neat trick: Right click on the Call Library Node and select “create C code” and in the file dialog enter a file name and location to save that C file.
LabVIEW will creat a C file with an empty function that has the correct parameter definitions for the function as configured in the Call Library Node at that moment.
The rest is understanding C programming which you of course do or you wouldn’t try this, would you?
if you need to allocate, resize or deallocate such a handle in your code you MUST use the LabVIEW exported memory management functions for that!