in reply to Accessors in xs

No XS-pert here either, but it looks to me like you are returning an AV*, ie. a ref to an array, rather than a list. You don't show the test code, but if you're doing

my( $x, $y ) = $obj->world_location;

That could be your problem?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Accessors in xs
by hardburn (Abbot) on Oct 24, 2005 at 19:04 UTC

    That was it. Applying chromatic's suggestion for a *PUSH* macro fixed it all:

    void world_location(self) SV* self PREINIT: HV *hash_self = (HV*) SvRV( self ); SV **x = hv_fetch( hash_self, "x", 1, FALSE ); SV **y = hv_fetch( hash_self, "y", 1, FALSE ); PPCODE: EXTEND(SP, 2); PUSHs( *x ); PUSHs( *y );

    Passes all tests. Thanks.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.