LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use buffer from a 3rd party dll.

Solved!
Go to solution

Thank you, I see how what I have done with disposing the pointer can be bad.  I have fixed that and the problem went away.  It makes sense now that I know what my mistake was.

0 Kudos
Message 11 of 13
(59 Views)

I have now integrated buffer allocation and reading using DSNewPtr, MoveBlock, and DSDestroyPtr into my application and this has solved the problem that I was having originally.  Although I have not run into problems yet with other parts of my code that are doing non-streaming reads from the Picoscope, I may modify them to use this method of buffer allocation anyway.  It seems like a better way of doing things.  Thank you very much for the help.

0 Kudos
Message 12 of 13
(52 Views)

You may not need to change everything. For the duration of a Call Library Node, buffers passed to the Call Library Node are guaranteed to be valid. It is when your DLL stores pointers to LabVIEW data handles to use after the function that passed them from the diagram returned execution back to LabVIEW, that things will start to potentially break.

 

Doing your own low level C style memory management for buffers that are only used synchronously (during the duration of the Call Library Node call) is a total waist of effort. 

Rolf Kalbermatter
Averna BV
0 Kudos
Message 13 of 13
(46 Views)