LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL Pointer within a Cluster

Solved!
Go to solution

Thank you nathan, will try to implement your ideas, and see how it goes.

 

~nsn

0 Kudos
Message 31 of 35
(740 Views)

Hi, While searching the forum for a working example using the DSNewPtr and MoveBlock functions, I came across Nathan's ReadWDF.vi.  I'm not sure if it conains a bug because it pre-allocates an array of half the number of bytes allocated by DSPtrNew.  If so, is that a problem for MoveBlock?

0 Kudos
Message 32 of 35
(640 Views)

Not sure exactly which code you're referring to, and I'm posting from a mobile device so I can't look at it any VIs right now, but if you're seeing a mismatch between Initialize Array and DSNewPtr, it's because the former is a number of elements (where the array element can be more than one byte) and the latter is a number of bytes. Initializing an array of U16 creates an array of twice that many bytes because each U16 is 2 bytes.

0 Kudos
Message 33 of 35
(634 Views)

Hi Nathand,

Please look at the code you posted.

X * 4 = 4X bytes allocated by DSNewPtr.

X * 2 (2 bytes per I16) = 2X bytes of array space.

fdewit noted that your example "kept crashing".

(The problem is corrected in other examples in this thread.)

 

Please note that this is not to be "critical"!

I benefit from your contributions and hope you keep-up the good work!

0 Kudos
Message 34 of 35
(626 Views)

You're right! Pity it took 6+ years for someone to point out the error (although I'm glad to hear it got corrected in the VIs from people who actually needed the code), but it's also nice to know that 6+ years later the code is still helpful as an example.

0 Kudos
Message 35 of 35
(610 Views)