in reply to Re^4: (SOLVED) XS: Passing an external library's function a Perl XS callback
in thread SOLVED: XS: Passing an external library's function a Perl XS callback

Hi, um, :) https://metacpan.org/pod/distribution/perl/pod/perlguts.pod#How-multiple-interpreters-and-concurrency-are-supported

So to the top add #define PERL_NO_GET_CONTEXT     /* we want efficiency */ and then

void callback(){ dTHX; /* fetch context */ ...
and thats it?

Replies are listed 'Best First'.
Re^6: (SOLVED) XS: Passing an external library's function a Perl XS callback
by syphilis (Archbishop) on Aug 16, 2016 at 00:10 UTC
    So to the top add #define PERL_NO_GET_CONTEXT

    PERL_NO_GET_CONTEXT doesn't work with Inline::C.
    You can do pre_head => '#define PERL_NO_GET_CONTEXT 1', and that will get the directive inserted at the very beginning of the generated XS file (where it needs to be).
    But Inline::C is not presently capable of generating XS code that meets the requirements of having PERL_NO_GET_CONTEXT defined.
    I filed a bug report about this some time back.

    InlineX::C2XS contains a rather flakey, fragile, sub-standard hack that does accommodate PERL_NO_GET_CONTEXT.
    It's functional enough for my purposes, but it does impose some limitations on the way one formats one's C code.

    Cheers,
    Rob