I've just committed two new functions, Parrot_api_wrap_pointer and
Parrot_api_unwrap_pointer. The first takes an opaque user data pointer
and wraps it up into a Ptr or PtrBuf PMC. The second takes that Ptr
PMC and returns your original pointer. Also, there's an optional size
parameter you can pass.
Andrew, I know you probably know about this, but just as a reminder. When
the pointer/pmc is passed to the external C function, that C function won't
have access to the INTERP pointer. If a PMC is passed to the C function, it
may be difficult to extract the void*.
Regards
-Original Message--
Sweet. Thanks, Andrew.
Is this code that users will be able to get at right away?
-Original Message-
From: Andrew Whitworth [mailto:wknight8...@gmail.com]
Sent: Wednesday, March 02, 2011 4:27 PM
To: Peter Lobsinger
Cc: Shockwave; parrot-dev@lists.parrot.org
Subject: Re: How to pass a C s
Hello Parrots,
As the next step for Deprecations as Data (which is one of the goals for
the 3.3 release), in the recent commit[1] I added a script which scans
code for deprecations and reports them to the user. The deprecations are
obviously taken from api.yaml, which now needs few more sections so
On Wed, Mar 2, 2011 at 4:22 PM, Peter Lobsinger wrote:
> Passing around pointers as ints is not advisable. We have pointer
> wrapper PMC types for this. You can wrap a pointer by doing something
> such as:
>
> PMC *ptr_pmc = Parrot_pmc_new(interp, enum_class_Ptr);
> VTABLE_set_pointer(interp, pt
Passing around pointers as ints is not advisable. We have pointer
wrapper PMC types for this. You can wrap a pointer by doing something
such as:
PMC *ptr_pmc = Parrot_pmc_new(interp, enum_class_Ptr);
VTABLE_set_pointer(interp, ptr_pmc, (void *)wb);
Sorry, I'm not sure what the embedding API e
What is the proper way to pass a C struct from the application embeeding
parrot to one of the libraries used from the generated PIR code?
So far, I've being trying to send the struct as a void*, converted to an
int, as the one argument to the :main sub. But I can't get it to work.
The follo