07-25-2010 01:56 PM
hi
I want to send to DLL 2D array modifay data and retrun it to labview .
i did it but the problem is that the data that i put before sending it to DLL sשty after
ן attache the DLL ad the VI
Thanks
sharon
07-26-2010 09:02 AM
Classic memory manager noob error! LabVIEW Array Handles are very special datatypes that have to be allocated, resized and deallocated by LabVIEW memory manager functions. malloc() has nothing to do in there at all (well deeper down in the LabVIEW memory manager functions malloc is used too but in a way you wouldn't want to care about and wouldn't want to rely about either since it could change between LabVIEW versions).
You have to decide about what you want to do:
1) Pass LabVIEW native datatypes and use LabVIEw memory manager functions. Be prepared to study a lot for that!
2) use standard C datatypes (a 2D array in standard C is still just a pointer to a single memory area and not a pointer to an array of pointers). If choosing 2) you have to allocate all the memory in the caller, e.g. LabVIEW and refrain from using any memory manager functions in the DLL for modifying that pointer in any way.
07-26-2010 12:29 PM
Tanks for your replay
if i want to use the second option ,how do i allocate the memory in LabVIEW?
regards
Sharon
07-26-2010 01:15 PM
Just create an array of the necessary size. Initialize Array is your friend here.