LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

function returning pointer to a table

  Hi,

I have a dll witch returns pointer to table of integers:

 

_declspec (dllexport) int process( char xname[], char yname[], char zname[], int DummyType,
                                  char OcciCondOff, int size)

{

 

 int *tab=new int[size];

...

 

 

return *tab;

}

 

is it possible to receive this table in LabView using Call Library Function Node? How? any other way to get the table from a function linked in dll?

 

 

Thx! 

0 Kudos
Message 1 of 3
(3,017 Views)

Hi przemmo,

 

My understanding that your problem is the thing that the returned value is a pointer.

 

I suggest you have a look at this link:

http://zone.ni.com/devzone/cda/epd/p/id/4489

 

Regards,

Marton

0 Kudos
Message 2 of 3
(2,974 Views)
Copy the data with any mem copy routine. You can use LabVIEW's mem copy
functions (defined in \cintools\extxcode.h). Or windows memcopy routines,
for example the routines to copy strings.

In the copy routines, use the pointer as source, and an array of U8's as
destination. This array should be properly initialized (it should be big
enough). The copy routine will copy the data to the array.

Now you have an array of u8's that has your flattened data. You can use
normal LabVIEW functions to convert it to the type you need. Typically, you
use resize array, interleave and decimate array, swap bytes and words, and
functions like that.

Regards,

Wiebe.


0 Kudos
Message 3 of 3
(2,969 Views)