05-29-2009 08:08 AM
Hello.
I've been given a LabView 8.5 DLL which I'm linking in a test C++ program and calling through an API method. The LabView 8.5 DLL's API method returns pointers to arrays. Is the memory of these arrays allocated statically or dynamically by LabView 8.5? How do I find out?
(In other words I want to know if I have to liberate the array's memory using free() or delete() when I'm done using it in the test C++ program)...
Thanks!
05-29-2009 01:56 PM
Hi,
LabVIEW is a memory managed software. This means that LabVIEW will automatically take care of the memory allocation and deallocation.
Have a look at this link. So in LabVIEW you dont have explicit functions like malloc() etc.
Also i'm curious as to how the dll is returning a pointer to arrays ( since you mentioned that the dll is built from LabVIEW). Are you sure about this?
05-29-2009 04:18 PM
Actually, after some experimentations, it was found out that the LabView 8.5 DLL does not allocate anything. It basically expects the caller (in this case a C++ program) to provide a preallocated array, which it then fills up. So the C++ program owns the allocated memory - I've somehow answered my own question myself... 🙂
05-29-2009 04:20 PM
Forgot to mention in my last reply: yes, the LabView 8.5 DLL API takes the preallocated array pointers (as in-out params) and array sizes (as in-params).