h2ph - convert .h C header files to .ph Perl header files
h2ph [-d destination_dir] [-r | -a] [-l] [header_file...]
The h2ph(1) utility converts C header files to the corresponding Perl header-file format. It is most easily run with the current directory set to /usr/include. For example:
cd /usr/include; h2ph * sys/*
or
cd /usr/include; h2ph -r -l .
The output files are placed in the hierarchy rooted at Perl's architecture-dependent library directory. You can specify a different hierarchy with a -d switch.
If run with no arguments, filters standard input to standard output.
[ error_condition ] at (eval mmm) line nnn
you will see the slightly more helpful
[ error_condition ] at filename.ph line nnn
However, the .ph files almost double in size when they are built using -h.No environment variables are used.
Larry Wall
The h2ph utility produces the usual warnings if it cannot read or write the files involved.
The h2ph utility does not construct the %sizeof array for you.
It does not handle all C constructs, but it does attempt to isolate definitions inside eval statements so that you can get at the definitions that it can translate.
It is only intended as a rough tool. You may need to modify the files produced.
It does not run with use strict.You have to run this program yourself; it is not run as part of the Perl installation.
It does not handle complicated expressions built like this:
enum {
FIRST_VALUE,
SECOND_VALUE,
#ifdef ABC
THIRD_VALUE
#endif
};
It might not locate all of your C compiler's internally defined symbols.