This XSUB will be invoked from Perl with the usage shown
above. Note that the first three #include statements, for
C<EXTERN.h>, C<perl.h>, and C<XSUB.h>, will always be present at the
-beginning of an XS file. This approach and others will be
-expanded later in this document.
+beginning of an XS file. PERL_NO_GET_CONTEXT should be present to use
+the modern Perl C API. This approach and others will be expanded later
+in this document.
+ #define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
Below is an example module that makes use of the macros.
+ #define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
File C<RPC.xs>: Interface to some ONC+ RPC bind library functions.
+ #define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
Finally, the Mytest.xs file should look something like this:
+ #define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
standard C library function C<fputs()>. This is all we need:
#define PERLIO_NOT_STDIO 0
+ #define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"