LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView 8.5 DLL called from C++ returns pointers to arrays - is the memory allocation static or dynamic?

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!

 

0 Kudos
Message 1 of 4
(3,274 Views)

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?

 

0 Kudos
Message 2 of 4
(3,260 Views)

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... 🙂

 

0 Kudos
Message 3 of 4
(3,254 Views)

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).

 

0 Kudos
Message 4 of 4
(3,253 Views)