Re: Perl bindings for libaosd: v0.01
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Perl bindings for libaosd: v0.01
- Date: Sat, 15 Mar 2008 16:04:00 +0100
On Sat, 2008-03-15 at 15:51 +0100, JÃrn Reder wrote:
- 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:
DESTROY (Aosd *aosd)
DESTROY is automatically called by perl when a variable goes out of
Ok, just tried it but it doesn't work, because my Perl object is a
scalar reference to Aosd*, so DESTROY doesn't get a Aosd* here, but a
Perl scalar, which needs to be dereferenced first.
I completely forgot to take a look at Aosd.pm. Nearly everything in
there should be removed. When you specify a PREFIX in Aosd.xs, xsubpp
automatically strips it off of the xsub names. So aosd_get_screen_size
becomes get_screen_size and so on.
MODULE = X11::Aosd PACKAGE = X11::Aosd PREFIX = aosd_
Then you need to alter the constructor so it can be used as
X11::Aosd->new and just ignores the class name:
/* void */
Then remove every method in Aosd.pm.
Is there a better way than building the Perl object on a scalar
reference to Aosd*?
In typemap, you specify that T_PTROBJ is to be used for Aosd*. That
means that whenever a Aosd* pointer is encountered, it automatically
gets wrapped as an opaque scalar. So that should be fine.
] [Thread Prev