Skip to content

Commit aa277c4

Browse files
committed
perlxs.pod: update EXPORT_XSUB_SYMBOLS, INCLUDE(_COMMAND)
1 parent ea0e873 commit aa277c4

File tree

1 file changed

+25
-42
lines changed

1 file changed

+25
-42
lines changed

dist/ExtUtils-ParseXS/lib/perlxs.pod

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,61 +1777,44 @@ See L<perlsub/Prototypes> for more information about Perl prototypes.
17771777

17781778
=head3 The EXPORT_XSUB_SYMBOLS: Keyword
17791779

1780-
The EXPORT_XSUB_SYMBOLS: keyword is likely something you will never need.
1781-
In perl versions earlier than 5.16.0, this keyword does nothing. Starting
1782-
with 5.16, XSUB symbols are no longer exported by default. That is, they
1783-
are C<static> functions. If you include
1780+
EXPORT_XSUB_SYMBOLS: ENABLE | DISABLE
17841781

1785-
EXPORT_XSUB_SYMBOLS: ENABLE
1782+
This keyword is present since 5.16.0, and its value is disabled by
1783+
default.
17861784

1787-
in your XS code, the XSUBs following this line will not be declared C<static>.
1788-
You can later disable this with
1789-
1790-
EXPORT_XSUB_SYMBOLS: DISABLE
1791-
1792-
which, again, is the default that you should probably never change.
1793-
You cannot use this keyword on versions of perl before 5.16 to make
1794-
XSUBs C<static>.
1785+
Before 5.16.0, the C function which implemented an XSUB was exported.
1786+
Since 5.16.0, it is declared C<static>. The old behaviour can be restored
1787+
by enabling it. You are very unlikely to have a need for this keyword.
17951788

17961789
=head3 The INCLUDE: Keyword
17971790

1798-
This keyword can be used to pull other files into the XS module. The other
1799-
files may have XS code. INCLUDE: can also be used to run a command to
1800-
generate the XS code to be pulled into the module.
1791+
INCLUDE: const-xs.inc
1792+
INCLUDE: some_command |
18011793

1802-
The file F<Rpcb1.xsh> contains our C<rpcb_gettime()> function:
1803-
1804-
bool_t
1805-
rpcb_gettime(host, timep)
1806-
char *host
1807-
time_t &timep
1808-
OUTPUT:
1809-
timep
1810-
1811-
The XS module can use INCLUDE: to pull that file into it.
1812-
1813-
INCLUDE: Rpcb1.xsh
1814-
1815-
If the parameters to the INCLUDE: keyword are followed by a pipe (C<|>) then
1816-
the compiler will interpret the parameters as a command. This feature is
1817-
mildly deprecated in favour of the C<INCLUDE_COMMAND:> directive, as documented
1818-
below.
1794+
This keyword can be used to pull in the contents of another file to the
1795+
"XS" part of an XS file. Unlike a top-level XS file, included files don't
1796+
have a "C" first half, and the entire contents of the file are treated as
1797+
XS, as if it had all been inserted at that line.
18191798

1820-
INCLUDE: cat Rpcb1.xsh |
1799+
One common use of C<INCLUDE> is to include constant definitions generated
1800+
by F<ExtUtils::Constant>.
18211801

1822-
Do not use this to run perl: C<INCLUDE: perl |> will run the perl that
1823-
happens to be the first in your path and not necessarily the same perl that is
1824-
used to run C<xsubpp>. See L<"The INCLUDE_COMMAND: Keyword">.
1802+
If the parameters to the C<INCLUDE> keyword are followed by a pipe (C<|>)
1803+
then the XS parser will interpret the parameters as a command. This
1804+
feature is mildly deprecated in favour of the C<INCLUDE_COMMAND:>
1805+
directive, as documented below. The latter can be used to ensure that the
1806+
perl (if any) used in the command is the same as the one running the XS
1807+
parser.
18251808

18261809
=head3 The INCLUDE_COMMAND: Keyword
18271810

1828-
Runs the supplied command and includes its output into the current XS
1829-
document. C<INCLUDE_COMMAND> assigns special meaning to the C<$^X> token
1830-
in that it runs the same perl interpreter that is running C<xsubpp>:
1811+
INCLUDE_COMMAND: $^X -e '...'
18311812

1832-
INCLUDE_COMMAND: cat Rpcb1.xsh
1813+
Since 5.14.0.
18331814

1834-
INCLUDE_COMMAND: $^X -e ...
1815+
Similar to C<INCLUDE: some_command|> except that the C<|> is implicit, and
1816+
it converts the special token C<$^X>, if present, to the path of the perl
1817+
interpreter which is running the XS parser.
18351818

18361819
=head3 The TYPEMAP: Keyword
18371820

0 commit comments

Comments
 (0)