{
    "mode": "man",
    "parameter": "H2PH",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/H2PH/1/json",
    "generated": "2026-06-03T14:21:42Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "h2ph - convert .h C header files to .ph Perl header files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "h2ph [-d destination directory] [-r | -a] [-l] [-h] [-e] [-D] [-Q] [headerfiles]",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "h2ph converts any C header files specified to the corresponding Perl header file format.  It\nis most easily run while in /usr/include:\n\ncd /usr/include; h2ph * sys/*\n\nor\n\ncd /usr/include; h2ph * sys/* arpa/* netinet/*\n\nor\n\ncd /usr/include; h2ph -r -l .\n\nThe output files are placed in the hierarchy rooted at Perl's architecture dependent library\ndirectory.  You can specify a different hierarchy with a -d switch.\n\nIf run with no arguments, filters standard input to standard output.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "-d destinationdir\nPut the resulting .ph files beneath destinationdir, instead of beneath the default Perl\nlibrary location ($Config{'installsitearch'}).\n\n-r  Run recursively; if any of headerfiles are directories, then run h2ph on all files in\nthose directories (and their subdirectories, etc.).  -r and -a are mutually exclusive.\n\n-a  Run automagically; convert headerfiles, as well as any .h files which they include.  This\noption will search for .h files in all directories which your C compiler ordinarily uses.\n-a and -r are mutually exclusive.\n\n-l  Symbolic links will be replicated in the destination directory.  If -l is not specified,\nthen links are skipped over.\n\n-h  Put 'hints' in the .ph files which will help in locating problems with h2ph.  In those\ncases when you require a .ph file containing syntax errors, instead of the cryptic\n\n[ some error condition ] at (eval mmm) line nnn\n\nyou will see the slightly more helpful\n\n[ some error condition ] at filename.ph line nnn\n\nHowever, the .ph files almost double in size when built using -h.\n\n-e  If an error is encountered during conversion, output file will be removed and a warning\nemitted instead of terminating the conversion immediately.\n\n-D  Include the code from the .h file as a comment in the .ph file.  This is primarily used\nfor debugging h2ph.\n\n-Q  'Quiet' mode; don't print out the names of the files being converted.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "No environment variables are used.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/usr/include/*.h\n/usr/include/sys/*.h\n\netc.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Larry Wall\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl(1)\n",
            "subsections": []
        },
        "DIAGNOSTICS": {
            "content": "The usual warnings if it can't read or write the files involved.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Doesn't construct the %sizeof array for you.\n\nIt doesn't handle all C constructs, but it does attempt to isolate definitions inside evals\nso that you can get at the definitions that it can translate.\n\nIt's only intended as a rough tool.  You may need to dicker with the files produced.\n\nYou have to run this program by hand; it's not run as part of the Perl installation.\n\nDoesn't handle complicated expressions built piecemeal, a la:\n\nenum {\nFIRSTVALUE,\nSECONDVALUE,\n#ifdef ABC\nTHIRDVALUE\n#endif\n};\n\nDoesn't necessarily locate all of your C compiler's internally-defined symbols.\n\n\n\nperl v5.34.0                                 2025-07-25                                      H2PH(1)",
            "subsections": []
        }
    },
    "summary": "h2ph - convert .h C header files to .ph Perl header files",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "perl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/perl/1/json"
        }
    ]
}