Re: Perl bindings for libaosd: v0.01



Torsten Schoenfeld wrote:

* Aosd.xs

  - I'm surprised to see no PREFIX in the MODULE line.  That's usually
needed so xsubpp knows how to form the method names.

The .xs is what h2xs gave me. So don't ask me... ;)

  - You expose aosd_destroy.  Try to avoid binding memory management
related functions.  In this case, you can automate releasing the object
by writing a DESTROY xsub which calls aosd_destroy:

Ah, clear. I wrote a perl DESTROY which called aosd_destroy, but of 
course there is no need for a perl wrapper here.

  - You use newSVnv to convert integers to SVs.  newSVnv is for floating
point numbers.  Use newSViv for signed integers.

This was a copy'n paste from somewhere... ;)

When you tell EU::Depends that Cairo is a dependency, you get access to
Cairo's typemaps.  So cairo_t* is handled automatically in normal
methods.

Cool.

Unfortunately, callbacks can't be handled automatically yet.  You need
to write a C function that has the specified signature.  You pass a
reference to this C function to aosd_set_renderer.  When aosd then
invokes the callback, your C function is called.  Now the C function
needs to invoke a Perl callback somehow.  To do that, you put a function
and a user data scalar into a struct and pass this struct to
aosd_set_renderer as user_data.  Your C function receives this struct as
the second argument, so you unpack it and use perl's API to invoke the
function scalar.
[...]

Ok, I will try this and report later.

Thanks for your feedback.

Regards,

Jörn

-- 
Joern Reder
-> http://www.exit1.org/
-> http://search.cpan.org/~jred/

Attachment: pgpaKMht0Vvqr.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]