ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DSnewptr address changes after calling dll function cause labview to crash when disposing pointer

Solved!
Go to solution

Hello, I try to deference 5 float arrays generated and passed from dll.

 

dll_debug_code.png  dll_debug_header.png

I use DSnewptr to allocate 5 memory blocks, and each block is set as size of (float) * array length;

All 5 dst arrays can successfully dereference the float values, however, this vi will crash when some of the DSDisposePtr are being called.

I guess it crashes due to the addresses from DSnewptr are somehow modified by my dll function, and wrong address are passed for disposing.

This vi will not crash if I set the "block size"(array length) less equal than 13, and the addresses generated by DSnewptr will not changed by CLFN.

Please help! Thank you.

dll_debug.png

Rediis_0-1750031206119.png

 

0 Kudos
Message 1 of 5
(851 Views)
Solution
Accepted by topic author Rediis

The readXindata call library node for the array arguments must be changed to pass by value

 

cordm_0-1750052466854.png

 

Message 3 of 5
(806 Views)

The same goes for the src parameter to MoveBlock. The value you have is already a pointer. You are effectively overwriting the pointer address. You can see that in the pictures: the input and output of the sx terminals should stay the same.

Message 4 of 5
(794 Views)

Thank you!! It works now!!!!

0 Kudos
Message 5 of 5
(757 Views)