On Thu, Feb 19, 2004 at 05:53:24PM -0500, Randy W. Sims said:
> I'm just catching up on some of the mailing lists, and it looks like no 
> ones answered your question, so...
>

Much appreciated.

> Unfortunatelly, there is little up-to-date documentation on mixing C++ 
> with XS (at least that I know about) although it is pretty well 
> supported. The best that I know of is a very brief section in "Extending 
> and Embedding Perl" <http://www.manning.com/jenness> 

I ended up prodding Simon Coznes and then getting the book and 
some general good old fashioned beating it to death until I managed 
to get it all working.

I ended using a typemap like

TYPEMAP
Reelmaker *     O_OBJECT
float           T_NV
    
OUTPUT
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
O_OBJECT
        sv_setref_pv( $arg, CLASS, (void*)$var );

    
INPUT
O_OBJECT
    if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
                $var = ($type)SvIV((SV*)SvRV( $arg ));
        else{
                warn( \"${Package}::$func_name() -- $var is not a 
                                        blessed SV reference\" );
                XSRETURN_UNDEF;
    }  





and after that adding all the functions was laughably simple to the 
point where I'm thinking of just writign a script that will rampage 
though and generate the XS for me.

I'd be happy to write up some faqs or a Perl.com article on what I did,
especially since I was simultaneously wrapping the same library in
Python and Lua.

FWIW I was also used Module::Build rather and ExtUtils::MakeMaker

Simon



Reply via email to