LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve a value from memory with pointer

I am attempting to use Labview to communicate with a PCI board (via DLL file) in order to control a CCD camera. When the board is initialized it returns a pointer. I need to access the handle for the board which is located at the memory location designated by the pointer. How can I, given that I know the pointer, find out the string that is stored in memory? Any help is appreciated.
0 Kudos
Message 1 of 8
(4,380 Views)
You can create your own dll or cin to retrive the string.

Good luck.

George Zou
http://gtoolbox.yeah.net
George Zou
0 Kudos
Message 2 of 8
(4,380 Views)
Hi,

I had the exact same problem with a DLL only returning a pointer. I solved this by making a simple CIN, passed the pointer as an input together with number of bytes to read and returning a byte array. You probably have to manipulated this byte array to get the format you need.

I attach a VI with the simple CIN and also the source code for the CIN if you need to rebuild or modify it in any way.

Regards,
Mattias Ericsson
Endevo Sweden
Download All
0 Kudos
Message 3 of 8
(4,380 Views)
Hi,

Do you need data, a value (handler) or a string from this pointer? If you
need data the following applies. Our do you want to get a handle to a string
at a pointer's adress?

You can use the Windows API "lstrcpyn" to retreive data from an adress. Make
the destination buffer large enough. The function copies the string until
/00 is encountered, and returns a pointer to the copied string, which LV
converts to a string. Get the size of the string. If it's shorter then the
expected length, it is truncted by a /00. Concatinate a /00 to the string,
and get the rest of the data from the pointer+stringlength+1. Repeat until
all data is in LabVIEW.

It's crude, but it works...

Regards,

Wiebe.

"Mark Hageman" wrote in message
news:50650000000800000083
AA0000-1066448259000@exchange.ni.com...
> I am attempting to use Labview to communicate with a PCI board (via
> DLL file) in order to control a CCD camera. When the board is
> initialized it returns a pointer. I need to access the handle for the
> board which is located at the memory location designated by the
> pointer. How can I, given that I know the pointer, find out the
> string that is stored in memory? Any help is appreciated.
0 Kudos
Message 4 of 8
(4,380 Views)
Hi,

The attached VI might work. I'm not able to test it very well right now...

Regards,

Wiebe.


"Wiebe@CARYA" wrote in message
news:3f9e9bac@newsgroups....
> Hi,
>
> Do you need data, a value (handler) or a string from this pointer? If you
> need data the following applies. Our do you want to get a handle to a
string
> at a pointer's adress?
>
> You can use the Windows API "lstrcpyn" to retreive data from an adress.
Make
> the destination buffer large enough. The function copies the string until
> /00 is encountered, and returns a pointer to the copied string, which LV
> converts to a string. Get the size of the string. If it's shorter then the
> expected length, it is truncted by a /00. Concatinate a /00 to the string
,
> and get the rest of the data from the pointer+stringlength+1. Repeat until
> all data is in LabVIEW.
>
> It's crude, but it works...
>
> Regards,
>
> Wiebe.
>
> "Mark Hageman" wrote in message
> news:50650000000800000083AA0000-1066448259000@exchange.ni.com...
> > I am attempting to use Labview to communicate with a PCI board (via
> > DLL file) in order to control a CCD camera. When the board is
> > initialized it returns a pointer. I need to access the handle for the
> > board which is located at the memory location designated by the
> > pointer. How can I, given that I know the pointer, find out the
> > string that is stored in memory? Any help is appreciated.
>
>



[Attachment pointer to pointer.vi, see below]
0 Kudos
Message 5 of 8
(4,380 Views)
Hi!

As far as I understand, incorrect value returned by your "pointer to pointer.vi".
Example for correct function in attachment.

with best regards
0 Kudos
Message 6 of 8
(4,380 Views)
Perhaps the reversed string at the end in incorrect, I'm not sure about
it...

Regards,

Wiebe.


"Andrey Dmitriev" wrote in message
news:50650000000500000089330100-1066448259000@exchange.ni.com...
> Hi!
>
> As far as I understand, incorrect value returned by your "pointer to
> pointer.vi".
> Example for correct function in attachment.
>
> with best regards
0 Kudos
Message 7 of 8
(4,380 Views)
Browsing for a way to test things (sorry, don't use LV7 jet..) I found this
dll.

Regards,

Wiebe


"Andrey Dmitriev" wrote in message
news:50650000000500000089330100-1066448259000@exchange.ni.com...
> Hi!
>
> As far as I understand, incorrect value returned by your "pointer to
> pointer.vi".
> Example for correct function in attachment.
>
> with best regards



[Attachment pointer.zip, see below]
0 Kudos
Message 8 of 8
(4,380 Views)