in reply to Re^3: Significance of #define PERL_GET_NO_CONTEXT in XS
in thread Significance of #define PERL_NO_GET_CONTEXT in XS
But handling pTHX_ and aTHX_ is way beyond Inline's current capabilities, and the XS file therefore needs to be written by hand.use strict; use warnings; use Inline C => Config => BUILD_NOISY => 1, PRE_HEAD => "#define PERL_NO_GET_CONTEXT", ; use Inline C => <<'EOC'; SV * dubble(SV * in) { dTHX; return newSViv(SvIV(in) * 2); } EOC my $x = dubble(23); print $x; # 46
But I wouldn't like to guarantee that it's not doing something wrong and/or unnecessary.#define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" SV * dubble(pTHX_ SV * in) { return newSViv(SvIV(in) * 2); } MODULE = FOO PACKAGE = FOO SV * dubble (in) SV * in CODE: RETVAL = dubble(aTHX_ in); OUTPUT: RETVAL
|
|---|