XSUBPP(1perl)
β¨ XSUBPP β¨
the xsubpp manual page, aka the Perl Programmers Reference Guide's own compiler-core bestie π
πΈ NAME πΈ
xsubpp β a compiler that converts Perl XS code into C code π¦
π SYNOPSIS π
xsubpp [-v] [-except] [-s pattern] [-prototypes] [-noversioncheck]
[-nolinenumbers] [-nooptimize] [-typemap typemap] [-output filename]...
file.xs
π DESCRIPTION π
okay so first thing: you're probably not even calling this yourself. This compiler basically gets run for you by the makefiles that ExtUtils::MakeMaker makes, or by Module::Build, or by whatever other Perl module build tools you're messing with. It's the backstage crew, not the main character (though honestly? lowkey main character energy).
xsubpp is literally just a thin wrapper over ExtUtils::ParseXS. That's the whole thing. No cap.
what it actually does: it compiles XS code into C code by embedding all the constructs you need so that C functions can manipulate Perl values, and it builds the glue that lets Perl get at those functions. The compiler uses typemaps to figure out how to map C function parameters and variables over to Perl values, and vice versa. it's giving translator, it's giving bridge between two worlds π
now, the compiler goes hunting for typemap files called typemap. It uses this search path to find typemaps, and it applies them in this order β so heads up, later typemaps take precedence over earlier ones π
map("$_/ExtUtils/typemap", reverse @INC),
../../../../lib/ExtUtils/typemap
../../../../typemap
../../../lib/ExtUtils/typemap
../../../typemap
../../lib/ExtUtils/typemap
../../typemap
../lib/ExtUtils/typemap
../typemap
typemap
any files specifed by -typemap
(and yes, "specifed" is spelled exactly like that in the original, we don't fix typos in this house, we preserve them π)
β¨ OPTIONS β¨
quick tea first: the "XSOPT" MakeMaker option can be used to add these options to any makefiles that MakeMaker generates. iykyk π«Ά
-hiertypeβ keeps the'::'in type names, so that C++ hierarchical types can be mapped. don't flatten the hierarchy bestie, it's structurally important π-exceptβ adds exception handling stubs to the C code. safety net vibes β¨-typemap typemapβ says hey, this user-supplied typemap should be applied in additon to any files found in the standard search path. (yes, "additon", again, preserving it fr fr.) You can use this option multiple times: the last typemap has the highest precedence π, and all of these files get processed after the ones found in the standard path.-output filenameβ names the output file to generate. If you don't specify a file at all, the output just goes to standard output. no filename, no problem π-vβ prints thexsubppversion number to standard output, then exits. cute, quick, done π-prototypesβ by defaultxsubppwill not automatically generate prototype code for all xsubs. This flag turns prototypes on. you want em? say so π-noversioncheckβ disables the run time test that checks whether the object file (the one derived from the.xsfile) and the.pmfiles have the same version number. living dangerously, obsessed π-nolinenumbersβ prevents'#line'directives from being included in the output. bye bye line numbers π-nooptimizeβ disables certain optimizations. The only optimization currently affected is the use of targets by the output C code (peepperlgutsfor that). Warning bestie: this may significantly slow down the generated code β but this is exactly howxsubppof 5.005 and earlier operated. retro, but at a cost π-noinoutβ disables recognition of"IN","OUT_LIST"and"INOUT_LIST"declarations.-noargtypesβ disables recognition of ANSI-like descriptions of function signatures.-C++β currently does absolutely nothing at all. This flag has been a no-op for many versions of perl, at least as far back asperl5.003_07. It's only allowed here for backwards compatibility. iconic fossil behavior, honestly π¦-s=...or-strip=...β this option is obscure and discouraged. periodt.
if you specify it, the given string gets stripped off from the beginning of the C function name in the generated XS functions (but only if it starts with that prefix). This only applies to XSUBs that don't have "CODE" or "PPCODE" blocks. For example, this XS:
void foo_bar(int i);
when "xsubpp" is invoked with -s foo_, will install a "foo_bar" function in Perl β but it will really call bar(i) in C. Most of the time this is literally the opposite of what you want, and the failure modes are somewhat obscure, so please avoid this option where possible. not me begging you to not use this π
πΈ ENVIRONMENT πΈ
No environment variables are used. that's it. that's the section. nothing to see here, clean slate, no secrets π
π AUTHOR π
Originally by Larry Wall. Turned into the "ExtUtils::ParseXS" module by Ken Williams. legends only.
π¦ MODIFICATION HISTORY π¦
See the file Changes.
π₯ SEE ALSO π₯
perl(1)perlxs(1)perlxstut(1)ExtUtils::ParseXS
and that's the whole page bestie, you're officially XS-pilled π
β¨ this was perl v5.44.0, dated 2026-10-17, from the Perl Programmers Reference Guide β mwah, go compile something gorgeous ππ«Ά
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms