LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an array back from CLN

Im calling into a DLL via a Call Library Node and one of the functions I would *like* to link to is such the the return value is a pointer to a x512 element array of doubles. I can get back this pointer value with no problem. Real question is after I get this value back is there a way to cast it to a standard LabVIEW array or even just to dereference the pointer?

I did some searching on the forums and looked around the developer zone but after two or three days of scratching my head I decided to give up and post...
0 Kudos
Message 1 of 4
(2,994 Views)


@chaos wrote:
Im calling into a DLL via a Call Library Node and one of the functions I would *like* to link to is such the the return value is a pointer to a x512 element array of doubles. I can get back this pointer value with no problem. Real question is after I get this value back is there a way to cast it to a standard LabVIEW array or even just to dereference the pointer?

I did some searching on the forums and looked around the developer zone but after two or three days of scratching my head I decided to give up and post...



You will have to use the LabVIEW internal function MoveBlock and call it over another Call Library Node. This is a somewhat unknown technique (and not officially documented in any LabVIEW manual as far as I know) but I have posted in the past some tips to do similar stuff. But explaining the configuration of a Call Library NOde is sort of difficult so I just created a VI which shows the technique of calling MoveBlock to copy the data of a pointer into a LabVIEW array. Hope this helps.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 4
(2,985 Views)
Thanks rolfk 😃

That example was excellent. I am very familiar with the CLNs so your example was all I needed. Very interesting. I never thought to look at LabVIEW before for exported functions...

Enjoy the stars
0 Kudos
Message 3 of 4
(2,974 Views)

@chaos wrote:
Thanks rolfk 😃

That example was excellent. I am very familiar with the CLNs so your example was all I needed. Very interesting. I never thought to look at LabVIEW before for exported functions...

Enjoy the stars



Well, my previous wording was actually a little unfortunate. You don't really need to call an internal LabVIEW function for this. Any function with the same functionality would work such as RtlMoveMemory in kernel32.dll or ntdll.dll or memcpy/memmove in msvcrt.dll. The advantage of using a LabVIEW internal function however is that the VI will equally run on all modern LabVIEW platforms, not just only Windows, or Mac or Linux, or other Unixes.
As to what can be called for internal LabVIEW functions just check out the Function Reference in the External Code manual. There are other functions exported for LabVIEWs own use, but they are undocumented and as such not useful at all for any production type application.

Rolf Kalbermatter

Message Edited by rolfk on 05-29-2005 05:36 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(2,969 Views)