LinuxCommandLibrary

h2ph

converts C header files to Perl headers

TLDR

Convert C header to Perl

$ h2ph [header.h]
copy
Process system headers
$ cd /usr/include && h2ph -r -l *.h
copy
Output to specific directory
$ h2ph -d [/usr/lib/perl5] [header.h]
copy
Recursive processing
$ h2ph -r [sys/types.h]
copy

SYNOPSIS

h2ph [options] [files]

DESCRIPTION

h2ph converts C header files to Perl headers. It translates #define macros and constant definitions for use in Perl programs.
The tool creates .ph files that Perl can require. It's used to access system constants defined in C headers from Perl code.

PARAMETERS

FILES

C header files to convert.
-d DIR
Output directory.
-r
Recursive processing.
-l
Symbolic links for duplicates.
-a
Generate autoload code.
-D DIR
Search directory.
--help
Display help information.

CAVEATS

Only handles simple #defines. Complex macros not translated. Output may need manual fixes.

HISTORY

h2ph has been part of Perl since early versions, enabling access to system constants from Perl programs.

SEE ALSO

h2xs(1), perl(1), perlapi(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community