LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using a DLL that passes back a pointer location to its own internal memory

I have a DLL which I would like to use in LabView

unfortunately, the DLL uses an internal memory buffer, and only passes back a pointer to the buffer.

I found some help on your web site which gets around this by using an undocumented LabView function

with an example: lvPointer.... Library name: LabView, Function Name MoveBlock

void MoveBlock(unsigned long src,long *dst, long size)

I understand that this function internally creates the memory and moves the data to the new location, returing the array.

I now have a huge memory leak, unless I can deallocate this memory (since I am getting data from the DLL into a new array every time, 50 times a second, 16k each time), how can I do this?

 

0 Kudos
Message 1 of 3
(2,451 Views)

hi there

i'm just guessing: who frees the initial memory (unsigned long src)?  have you tried to call free(unsigned long src) after MoveBlock?

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 3
(2,446 Views)
Appologies, I was being stupid.
The BlockMove is passed a buffer in the first place, so I can just reuse it, while the DLL cleans itself up.
 
Thank for the help
 
Best regards
0 Kudos
Message 3 of 3
(2,442 Views)