@@ -3362,39 +3362,47 @@ C<XSRETURN(1);> or similar.
33623362
33633363=head2 XSUB Generic Keywords
33643364
3365- XXX TBC
3365+ There are a few per-XSUB keywords which can appear anywhere within the
3366+ body of an XSUB. This is because they affect how the XSUB is registered
3367+ with the Perl interpreter, rather than affecting how the C code of the
3368+ XSUB itself is generated. These are described in the following
3369+ subsections. In addition there are a few more generic keywords which are
3370+ described later under L<Sharing XSUB bodies>.
33663371
3367- These keywords can appear anywhere within the body of an XSUB.
3372+ On aesthetic grounds, it is best to use these keywords near the start of
3373+ the XSUB.
33683374
33693375=head3 The PROTOTYPE: Keyword
33703376
3371- This keyword is similar to the PROTOTYPES: keyword above but can be used to
3372- force B<xsubpp> to use a specific prototype for the XSUB. This keyword
3373- overrides all other prototype options and keywords but affects only the
3374- current XSUB. Consult L<perlsub/Prototypes> for information about Perl
3375- prototypes.
3377+ int
3378+ foo1(int a, int b = 0)
3379+ # this XSUB gets an auto-generated '$;$' prototype
3380+ PROTOTYPE: ENABLE
33763381
3377- bool_t
3378- rpcb_gettime(timep, ...)
3379- time_t timep = NO_INIT
3380- PROTOTYPE: $;$
3381- PREINIT:
3382- char *host = "localhost";
3383- CODE:
3384- if (items > 1)
3385- host = (char *)SvPVbyte_nolen(ST(1));
3386- RETVAL = rpcb_gettime(host, &timep);
3387- OUTPUT:
3388- timep
3389- RETVAL
3382+ int
3383+ foo2(int a, int b)
3384+ # this XSUB doesn't get a prototype
3385+ PROTOTYPE: DISABLE
33903386
3391- If the prototypes are enabled, you can disable it locally for a given
3392- XSUB as in the following example:
3387+ int
3388+ foo3(SV* a, int b)
3389+ # this XSUB gets the specified prototype:
3390+ PROTOTYPE: \@$
33933391
3394- void
3395- rpcb_gettime_noproto()
3396- PROTOTYPE: DISABLE
3397- ...
3392+ int
3393+ foo4(int a, int b)
3394+ # this XSUB gets a blank () prototype
3395+ PROTOTYPE:
3396+
3397+ While the file-scoped C<PROTOTYPES> keyword turns automatic prototype
3398+ generation on or off for all subsequent XSUBs, the per-XSUB C<PROTOTYPE>
3399+ keyword overrides the setting for just the current XSUB. See the
3400+ L<PROTOTYPES|/The PROTOTYPES: Keyword> section for details of what a
3401+ prototype is, and why you rarely need one.
3402+
3403+ This keyword's value can be either one of C<ENABLE>/C<DISABLE> to turn on
3404+ or off automatic prototype generation, or it can specify an explicit
3405+ prototype string, including the empty prototype.
33983406
33993407=head3 The OVERLOAD: Keyword
34003408
0 commit comments