.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "ExtUtils::ParseXS 3perl" .TH ExtUtils::ParseXS 3perl 2024-05-30 "perl v5.38.2" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME ExtUtils::ParseXS \- converts Perl XS code into C code .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use ExtUtils::ParseXS; \& \& my $pxs = ExtUtils::ParseXS\->new; \& $pxs\->process_file( filename => \*(Aqfoo.xs\*(Aq ); \& \& $pxs\->process_file( filename => \*(Aqfoo.xs\*(Aq, \& output => \*(Aqbar.c\*(Aq, \& \*(AqC++\*(Aq => 1, \& typemap => \*(Aqpath/to/typemap\*(Aq, \& hiertype => 1, \& except => 1, \& versioncheck => 1, \& linenumbers => 1, \& optimize => 1, \& prototypes => 1, \& die_on_error => 0, \& ); \& \& # Legacy non\-OO interface using a singleton: \& use ExtUtils::ParseXS qw(process_file); \& process_file( filename => \*(Aqfoo.xs\*(Aq ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`ExtUtils::ParseXS\*(C'\fR will compile XS code into C code by embedding the constructs necessary to let C functions manipulate Perl values and creates the glue necessary to let Perl access those functions. The compiler uses typemaps to determine how to map C function parameters and variables to Perl values. .PP The compiler will search for typemap files called \fItypemap\fR. It will use the following search path to find default typemaps, with the rightmost typemap taking precedence. .PP .Vb 1 \& ../../../typemap:../../typemap:../typemap:typemap .Ve .SH EXPORT .IX Header "EXPORT" None by default. \f(CWprocess_file()\fR and/or \f(CWreport_error_count()\fR may be exported upon request. Using the functional interface is discouraged. .SH METHODS .IX Header "METHODS" .ie n .IP $pxs\->\fBnew()\fR 4 .el .IP \f(CW$pxs\fR\->\fBnew()\fR 4 .IX Item "$pxs->new()" Returns a new, empty XS parser/compiler object. .ie n .IP $pxs\->\fBprocess_file()\fR 4 .el .IP \f(CW$pxs\fR\->\fBprocess_file()\fR 4 .IX Item "$pxs->process_file()" This method processes an XS file and sends output to a C file. The method may be called as a function (this is the legacy interface) and will then use a singleton as invocant. .Sp Named parameters control how the processing is done. The following parameters are accepted: .RS 4 .IP \fBC++\fR 4 .IX Item "C++" Adds \f(CW\*(C`extern "C"\*(C'\fR to the C code. Default is false. .IP \fBhiertype\fR 4 .IX Item "hiertype" Retains \f(CW\*(C`::\*(C'\fR in type names so that C++ hierarchical types can be mapped. Default is false. .IP \fBexcept\fR 4 .IX Item "except" Adds exception handling stubs to the C code. Default is false. .IP \fBtypemap\fR 4 .IX Item "typemap" Indicates that a user-supplied typemap should take precedence over the default typemaps. A single typemap may be specified as a string, or multiple typemaps can be specified in an array reference, with the last typemap having the highest precedence. .IP \fBprototypes\fR 4 .IX Item "prototypes" Generates prototype code for all xsubs. Default is false. .IP \fBversioncheck\fR 4 .IX Item "versioncheck" Makes sure at run time that the object file (derived from the \f(CW\*(C`.xs\*(C'\fR file) and the \f(CW\*(C`.pm\*(C'\fR files have the same version number. Default is true. .IP \fBlinenumbers\fR 4 .IX Item "linenumbers" Adds \f(CW\*(C`#line\*(C'\fR directives to the C output so error messages will look like they came from the original XS file. Default is true. .IP \fBoptimize\fR 4 .IX Item "optimize" Enables certain optimizations. The only optimization that is currently affected is the use of \fItarget\fRs by the output C code (see perlguts). Not optimizing may significantly slow down the generated code, but this is the way \&\fBxsubpp\fR of 5.005 and earlier operated. Default is to optimize. .IP \fBinout\fR 4 .IX Item "inout" Enable recognition of \f(CW\*(C`IN\*(C'\fR, \f(CW\*(C`OUT_LIST\*(C'\fR and \f(CW\*(C`INOUT_LIST\*(C'\fR declarations. Default is true. .IP \fBargtypes\fR 4 .IX Item "argtypes" Enable recognition of ANSI-like descriptions of function signature. Default is true. .IP \fBs\fR 4 .IX Item "s" \&\fIMaintainer note:\fR I have no clue what this does. Strips function prefixes? .IP \fBdie_on_error\fR 4 .IX Item "die_on_error" Normally ExtUtils::ParseXS will terminate the program with an \f(CWexit(1)\fR after printing the details of the exception to STDERR via (warn). This can be awkward when it is used programmatically and not via xsubpp, so this option can be used to cause it to die instead by providing a true value. When not provided this defaults to the value of \f(CW$ExtUtils::ParseXS::DIE_ON_ERROR\fR which in turn defaults to false. .RE .RS 4 .RE .ie n .IP $pxs\->\fBreport_error_count()\fR 4 .el .IP \f(CW$pxs\fR\->\fBreport_error_count()\fR 4 .IX Item "$pxs->report_error_count()" This method returns the number of [a certain kind of] errors encountered during processing of the XS file. .Sp The method may be called as a function (this is the legacy interface) and will then use a singleton as invocant. .SH AUTHOR .IX Header "AUTHOR" Based on xsubpp code, written by Larry Wall. .PP Maintained by: .IP \(bu 4 Ken Williams, .IP \(bu 4 David Golden, .IP \(bu 4 James Keenan, .IP \(bu 4 Steffen Mueller, .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2002\-2014 by Ken Williams, David Golden and other contributors. All rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP Based on the \f(CW\*(C`ExtUtils::xsubpp\*(C'\fR code by Larry Wall and the Perl 5 Porters, which was released under the same license terms. .SH "SEE ALSO" .IX Header "SEE ALSO" perl, ExtUtils::xsubpp, ExtUtils::MakeMaker, perlxs, perlxstut.