LinuxCommandLibrary

h2xs

creates Perl extension module skeletons

TLDR

Create XS module skeleton

$ h2xs -A -n [Module::Name]
copy
Create module from C header
$ h2xs [header.h]
copy
Create pure Perl module
$ h2xs -AX -n [Module::Name]
copy
Omit autoload
$ h2xs -An [Module::Name]
copy

SYNOPSIS

h2xs [options] [headers]

DESCRIPTION

h2xs creates Perl extension module skeletons. It generates XS code to wrap C libraries, making them accessible from Perl.
The tool creates directory structure, Makefile.PL, and stub files. It can generate bindings from C header files or create empty module templates.

PARAMETERS

HEADERS

C header files to wrap.
-n NAME
Module name.
-A
Omit Autoloader code.
-X
Omit XS code (pure Perl).
-c
Omit constant code.
-O
Overwrite existing files.
-b VER
Perl version compatibility.
--help
Display help information.

CAVEATS

Generated code needs customization. Complex C APIs require manual XS. Understanding C/XS helpful.

HISTORY

h2xs has been part of Perl since version 5, providing the standard way to create XS extension modules.

SEE ALSO

xsubpp(1), perlxs(1), h2ph(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community