Joshua N Pritikin wrote:
>
> > pretty straightforward and the wrapper is pretty thin. Anybody writing
> > *straightforward* XS would do it pretty much the same way as Inline.
>
> Not necessarily. Inline uses a peculiar style which exposes both entry
> points. For example, it generates code like this:
>
> --+--
> int my_function(int xx) { return xx * xx; }
>
> MODULE = Math PACKAGE = Math
>
> void
> my_function(int xx)
> int xx:
> PPCODE:
> XPUSHs(newSViv(my_function(xx)));
> --+--
> > You
> > almost always see XSUBS implemented as wrappers to native C functions.
> > The typemapping has to happen somewhere.
>
> But usually the body of the function is placed directly in the XSUB and
> there isn't an extra function call. However,
I guess what I thought was normal, is actually not. I'll trust your
judgement of normality, since you've probably seen a lot more XS code.
(I'm no old hand at XS. I'd only done one XS project before I decided
there must be a better way)
> i wasn't and am not considering performance at any point in this thread.
> The concern here is whether the C & Perl APIs can match, from the point
> of view of the naive developer.
Well I'm glad my peculiar implementation of XS actually helps in this
respect. :)
Brian
--
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf
("Just Another %s Hacker",x);}};print JAxH+Perl'