develooper Front page | perl.perl5.porters | Postings from February 2000

[5.5.660] class methods and xsubpp

Thread Next
From:
Hugo
Date:
February 24, 2000 08:00
Subject:
[5.5.660] class methods and xsubpp
Message ID:
200002241605.QAA07060@crypt.compulink.co.uk
This XS code:

int
MyClass::method()

.. checks the THIS argument like this:

        if (sv_derived_from(ST(0), "MyClassPtr")) {
            IV tmp = SvIV((SV*)SvRV(ST(0)));
            THIS = INT2PTR(MyClass *,tmp);
        }
        else
            croak("THIS is not of type MyClassPtr");

.. which is a problem, since the method will be invoked by perl on a
MyClass object, not on a MyClassPtr object. I'm not sure what the right
solution is for this - has anyone successfully used this type of
invocation? (I note that it does not appear to be documented in perlxs.)

Hugo

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About