This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync EU::ParseXS Changes and $VERSION with CPAN
[perl5.git] / dist / ExtUtils-ParseXS / lib / ExtUtils / ParseXS.pod
CommitLineData
a65c06db
S
1=head1 NAME
2
3ExtUtils::ParseXS - converts Perl XS code into C code
4
5=head1 SYNOPSIS
6
7 use ExtUtils::ParseXS qw(process_file);
8
9 process_file( filename => 'foo.xs' );
10
11 process_file( filename => 'foo.xs',
12 output => 'bar.c',
13 'C++' => 1,
14 typemap => 'path/to/typemap',
15 hiertype => 1,
16 except => 1,
17 prototypes => 1,
18 versioncheck => 1,
19 linenumbers => 1,
20 optimize => 1,
21 prototypes => 1,
22 );
23
24=head1 DESCRIPTION
25
26C<ExtUtils::ParseXS> will compile XS code into C code by embedding the constructs
27necessary to let C functions manipulate Perl values and creates the glue
28necessary to let Perl access those functions. The compiler uses typemaps to
29determine how to map C function parameters and variables to Perl values.
30
31The compiler will search for typemap files called I<typemap>. It will use
32the following search path to find default typemaps, with the rightmost
33typemap taking precedence.
34
35 ../../../typemap:../../typemap:../typemap:typemap
36
37=head1 EXPORT
38
39None by default. C<process_file()> may be exported upon request.
40
41=head1 FUNCTIONS
42
43=over 4
44
c667e096 45=item process_file()
a65c06db
S
46
47This function processes an XS file and sends output to a C file.
48Named parameters control how the processing is done. The following
49parameters are accepted:
50
51=over 4
52
53=item B<C++>
54
55Adds C<extern "C"> to the C code. Default is false.
56
57=item B<hiertype>
58
629b8367 59Retains C<::> in type names so that C++ hierarchical types can be
a65c06db
S
60mapped. Default is false.
61
62=item B<except>
63
64Adds exception handling stubs to the C code. Default is false.
65
66=item B<typemap>
67
68Indicates that a user-supplied typemap should take precedence over the
69default typemaps. A single typemap may be specified as a string, or
70multiple typemaps can be specified in an array reference, with the
71last typemap having the highest precedence.
72
73=item B<prototypes>
74
75Generates prototype code for all xsubs. Default is false.
76
77=item B<versioncheck>
78
79Makes sure at run time that the object file (derived from the C<.xs>
80file) and the C<.pm> files have the same version number. Default is
81true.
82
83=item B<linenumbers>
84
85Adds C<#line> directives to the C output so error messages will look
86like they came from the original XS file. Default is true.
87
88=item B<optimize>
89
90Enables certain optimizations. The only optimization that is currently
91affected is the use of I<target>s by the output C code (see L<perlguts>).
92Not optimizing may significantly slow down the generated code, but this is the way
93B<xsubpp> of 5.005 and earlier operated. Default is to optimize.
94
95=item B<inout>
96
97Enable recognition of C<IN>, C<OUT_LIST> and C<INOUT_LIST>
98declarations. Default is true.
99
100=item B<argtypes>
101
102Enable recognition of ANSI-like descriptions of function signature.
103Default is true.
104
105=item B<s>
106
c870602e 107I<Maintainer note:> I have no clue what this does. Strips function prefixes?
a65c06db
S
108
109=back
110
111=item errors()
112
113This function returns the number of [a certain kind of] errors
114encountered during processing of the XS file.
115
116=back
117
a65c06db
S
118=head1 AUTHOR
119
120Based on xsubpp code, written by Larry Wall.
121
122Maintained by:
123
124=over 4
125
126=item *
127
128Ken Williams, <ken@mathforum.org>
129
130=item *
131
132David Golden, <dagolden@cpan.org>
133
c870602e
S
134=item *
135
136James Keenan, <jkeenan@cpan.org>
137
138=item *
139
140Steffen Mueller, <smueller@cpan.org>
141
a65c06db
S
142=back
143
144=head1 COPYRIGHT
145
c870602e 146Copyright 2002-2011 by Ken Williams, David Golden and other contributors. All
a65c06db
S
147rights reserved.
148
149This library is free software; you can redistribute it and/or
150modify it under the same terms as Perl itself.
151
c870602e 152Based on the C<ExtUtils::xsubpp> code by Larry Wall and the Perl 5
a65c06db
S
153Porters, which was released under the same license terms.
154
155=head1 SEE ALSO
156
157L<perl>, ExtUtils::xsubpp, ExtUtils::MakeMaker, L<perlxs>, L<perlxstut>.
158
159=cut
160
161