03-09-2005 10:33 AM
03-10-2005 06:50 PM
03-10-2005 07:18 PM
03-11-2005 01:52 PM
03-11-2005 02:43 PM - edited 03-11-2005 02:43 PM
Message Edited by Warren Massey on 03-11-2005 12:45 PM
Message Edited by Warren Massey on 03-11-2005 12:47 PM
03-12-2005 11:33 AM
03-12-2005 12:17 PM
03-12-2005 05:51 PM - edited 03-12-2005 05:51 PM
Message Edited by Warren Massey on 03-12-2005 03:52 PM
03-12-2005 05:51 PM
@steven H. wrote:
As I understand it, using the variant works but is too slow. Variants do have overhead. Here is a possible way to get faster performance, but it is more work:
Create a DLL that takes as a parameter a LabVIEW array which you pass into the DLL from the block diagram via the Call Library function.
In the DLL:
1. Call LockForReadPtr.
2. Figure out the size of the data at the pointer that LockForReadPtr returns.
3. Resize the LabVIEW array so that it is large enough to hold that data, using the LabVIEW memory manager functions (e.g. NumericArrayResize). These are explained in the "Using External Code in LabVIEW" manual.
4. Copy the data into the LabVIEW array.
Step 3 is actually only necessary if you don't know the size of the returned image in advance. If you do know, then you can pass a constant LabVIEW array of sufficient size from the block diagram, and avoid resizing it in the DLL. This is highly preferable!
Following these steps, you should be able to use the array that comes out of the right hand side of the Call Library function.
Steven H.
03-12-2005 06:24 PM