Re: Perl bindings for libaosd: v0.01



On Sat, 2008-03-15 at 16:47 +0100, JÃrn Reder wrote:

This way I get a blessed AosdPtr SCALAR ref and Perl can't find any of 
the binded methods in the AosdPtr package (hmm, is this namespace 
pollution acceptable?) - only new() and DESTROY() work as expected now 
;)

Ah, of course.  You'll need a custom typemap then.  Change the entry for
Aosd*:

Aosd *              T_AOSD_OBJECT

And at the end of the file, add:

INPUT

T_AOSD_OBJECT
        if (sv_derived_from ($arg, \"X11::Aosd\")) {
                IV tmp = SvIV ((SV *) SvRV ($arg));
                $var = INT2PTR ($type, tmp);
        } else {
                Perl_croak(aTHX_ \"$var is not of type X11::Aosd\");
        }

OUTPUT

T_AOSD_OBJECT
        sv_setref_pv ($arg, \"X11::Aosd\", (void *) $var);

This represents a Aosd* pointer as an opaque scalar that is blessed into
the package X11::Aosd.

-- 
Bye,
-Torsten




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