annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

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 Compliments
Message 1 sur 4
3 777 Visites

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 Compliments
Message 2 sur 4
3 763 Visites

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 Compliments
Message 3 sur 4
3 757 Visites

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 Compliments
Message 4 sur 4
3 756 Visites