Re: NativeCall pointer question?

2022-11-20 Thread ToddAndMargo via perl6-users
On Sun, Nov 20, 2022 at 3:48 AM ToddAndMargo via perl6-users 
mailto:perl6-users@perl.org>> wrote:


Hi All,

In one of my native call, I get returned a
pointer to a DWORD (uint32).

How do I turn that into the actual value
in the DWORD?

Many thanks,
-T



On 11/20/22 16:00, Clifton Wood wrote:

@ToddAndMargo,

Two ways:

  - Use "my CArray[uint32] $p", use $p as your parameter, and access the 
value as "$p[0]"


or

- Use "my Pointer[uint32] $p"  and use "$p.deref"

My personal preference is the former, as it is the best way to access 
AND set the actual former value. The latter can only deref. To my 
knowledge, you cannot set the referenced value of a Pointer type. I do 
reserve the right to be wrong on this, though.



Thank you!

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~



Re: NativeCall pointer question?

2022-11-20 Thread Clifton Wood
@ToddAndMargo,

Two ways:

 - Use "my CArray[uint32] $p", use $p as your parameter, and access the
value as "$p[0]"

or

- Use "my Pointer[uint32] $p"  and use "$p.deref"

My personal preference is the former, as it is the best way to access AND
set the actual former value. The latter can only deref. To my knowledge,
you cannot set the referenced value of a Pointer type. I do reserve the
right to be wrong on this, though.



On Sun, Nov 20, 2022 at 3:48 AM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> Hi All,
>
> In one of my native call, I get returned a
> pointer to a DWORD (uint32).
>
> How do I turn that into the actual value
> in the DWORD?
>
> Many thanks,
> -T
>


NativeCall pointer question?

2022-11-20 Thread ToddAndMargo via perl6-users

Hi All,

In one of my native call, I get returned a
pointer to a DWORD (uint32).

How do I turn that into the actual value
in the DWORD?

Many thanks,
-T