{
    "mode": "man",
    "parameter": "H2XS",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/H2XS/1/json",
    "generated": "2026-06-07T09:57:23Z",
    "synopsis": "h2xs [OPTIONS ...] [headerfile ... [extralibraries]]\nh2xs -h|-?|--help",
    "sections": {
        "NAME": {
            "content": "h2xs - convert .h C header files to Perl extensions\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "h2xs [OPTIONS ...] [headerfile ... [extralibraries]]\n\nh2xs -h|-?|--help\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "h2xs builds a Perl extension from C header files.  The extension will include functions which\ncan be used to retrieve the value of any #define statement which was in the C header files.\n\nThe modulename will be used for the name of the extension.  If modulename is not supplied\nthen the name of the first header file will be used, with the first character capitalized.\n\nIf the extension might need extra libraries, they should be included here.  The extension\nMakefile.PL will take care of checking whether the libraries actually exist and how they\nshould be loaded.  The extra libraries should be specified in the form -lm -lposix, etc, just\nas on the cc command line.  By default, the Makefile.PL will search through the library path\ndetermined by Configure.  That path can be augmented by including arguments of the form",
            "subsections": [
                {
                    "name": "-L/another/library/path",
                    "content": "In spite of its name, h2xs may also be used to create a skeleton pure Perl module. See the -X\noption.\n"
                }
            ]
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-A --omit-autoload",
                    "content": "Omit all autoload facilities.  This is the same as -c but also removes the\n\"use AutoLoader\" statement from the .pm file.\n",
                    "flag": "-A",
                    "long": "--omit-autoload"
                },
                {
                    "name": "-B --beta-version",
                    "content": "Use an alpha/beta style version number.  Causes version number to be \"0.0001\" unless -v\nis specified.\n",
                    "flag": "-B",
                    "long": "--beta-version"
                },
                {
                    "name": "-C --omit-changes",
                    "content": "Omits creation of the Changes file, and adds a HISTORY section to the POD template.\n",
                    "flag": "-C",
                    "long": "--omit-changes"
                },
                {
                    "name": "-F --cpp-flags",
                    "content": "Additional flags to specify to C preprocessor when scanning header for function\ndeclarations.  Writes these options in the generated Makefile.PL too.\n",
                    "flag": "-F",
                    "long": "--cpp-flags"
                },
                {
                    "name": "-M --func-mask",
                    "content": "selects functions/macros to process.\n",
                    "flag": "-M",
                    "long": "--func-mask"
                },
                {
                    "name": "-O --overwrite-ok",
                    "content": "Allows a pre-existing extension directory to be overwritten.\n",
                    "flag": "-O",
                    "long": "--overwrite-ok"
                },
                {
                    "name": "-P --omit-pod",
                    "content": "Omit the autogenerated stub POD section.\n",
                    "flag": "-P",
                    "long": "--omit-pod"
                },
                {
                    "name": "-X --omit-XS",
                    "content": "Omit the XS portion. Used to generate a skeleton pure Perl module.  \"-c\" and \"-f\" are\nimplicitly enabled.\n",
                    "flag": "-X",
                    "long": "--omit-XS"
                },
                {
                    "name": "-a --gen-accessors",
                    "content": "Generate an accessor method for each element of structs and unions. The generated\nmethods are named after the element name; will return the current value of the element\nif called without additional arguments; and will set the element to the supplied value\n(and return the new value) if called with an additional argument. Embedded structures\nand unions are returned as a pointer rather than the complete structure, to facilitate\nchained calls.\n\nThese methods all apply to the Ptr type for the structure; additionally two methods are\nconstructed for the structure type itself, \"toptr\" which returns a Ptr type pointing\nto the same structure, and a \"new\" method to construct and return a new structure,\ninitialised to zeroes.\n",
                    "flag": "-a",
                    "long": "--gen-accessors"
                },
                {
                    "name": "-b --compat-version",
                    "content": "Generates a .pm file which is backwards compatible with the specified perl version.\n\nFor versions < 5.6.0, the changes are.\n- no use of 'our' (uses 'use vars' instead)\n- no 'use warnings'\n\nSpecifying a compatibility version higher than the version of perl you are using to run\nh2xs will have no effect.  If unspecified h2xs will default to compatibility with the\nversion of perl you are using to run h2xs.\n",
                    "flag": "-b",
                    "long": "--compat-version"
                },
                {
                    "name": "-c --omit-constant",
                    "content": "Omit \"constant()\" from the .xs file and corresponding specialised \"AUTOLOAD\" from the\n.pm file.\n",
                    "flag": "-c",
                    "long": "--omit-constant"
                },
                {
                    "name": "-d --debugging",
                    "content": "Turn on debugging messages.\n",
                    "flag": "-d",
                    "long": "--debugging"
                },
                {
                    "name": "-e --omit-enums",
                    "content": "If regular expression is not given, skip all constants that are defined in a C\nenumeration. Otherwise skip only those constants that are defined in an enum whose name\nmatches regular expression.\n\nSince regular expression is optional, make sure that this switch is followed by at least\none other switch if you omit regular expression and have some pending arguments such as\nheader-file names. This is ok:\n\nh2xs -e -n Module::Foo foo.h\n\nThis is not ok:\n\nh2xs -n Module::Foo -e foo.h\n\nIn the latter, foo.h is taken as regular expression.\n",
                    "flag": "-e",
                    "long": "--omit-enums"
                },
                {
                    "name": "-f --force",
                    "content": "Allows an extension to be created for a header even if that header is not found in\nstandard include directories.\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-g --global",
                    "content": "Include code for safely storing static data in the .xs file.  Extensions that do no make\nuse of static data can ignore this option.\n",
                    "flag": "-g",
                    "long": "--global"
                },
                {
                    "name": "-h -? --help",
                    "content": "Print the usage, help and version for this h2xs and exit.\n",
                    "flag": "-?",
                    "long": "--help"
                },
                {
                    "name": "-k --omit-const-func",
                    "content": "For function arguments declared as \"const\", omit the const attribute in the generated XS\ncode.\n",
                    "flag": "-k",
                    "long": "--omit-const-func"
                },
                {
                    "name": "-m --gen-tied-var",
                    "content": "Experimental: for each variable declared in the header file(s), declare a perl variable\nof the same name magically tied to the C variable.\n",
                    "flag": "-m",
                    "long": "--gen-tied-var"
                },
                {
                    "name": "-n --name",
                    "content": "Specifies a name to be used for the extension, e.g., -n RPC::DCE\n",
                    "flag": "-n",
                    "long": "--name"
                },
                {
                    "name": "-o --opaque-re",
                    "content": "Use \"opaque\" data type for the C types matched by the regular expression, even if these\ntypes are \"typedef\"-equivalent to types from typemaps.  Should not be used without -x.\n\nThis may be useful since, say, types which are \"typedef\"-equivalent to integers may\nrepresent OS-related handles, and one may want to work with these handles in OO-way, as\nin \"$handle->dosomething()\".  Use \"-o .\" if you want to handle all the \"typedef\"ed\ntypes as opaque types.\n\nThe type-to-match is whitewashed (except for commas, which have no whitespace before\nthem, and multiple \"*\" which have no whitespace between them).\n",
                    "flag": "-o",
                    "long": "--opaque-re"
                },
                {
                    "name": "-p --remove-prefix",
                    "content": "Specify a prefix which should be removed from the Perl function names, e.g., -p secrgy\nThis sets up the XS PREFIX keyword and removes the prefix from functions that are\nautoloaded via the \"constant()\" mechanism.\n",
                    "flag": "-p",
                    "long": "--remove-prefix"
                },
                {
                    "name": "-s --const-subs",
                    "content": "Create a perl subroutine for the specified macros rather than autoload with the\nconstant() subroutine.  These macros are assumed to have a return type of char *, e.g.,\n-s secrgywildcardname,secrgywildcardsid.\n",
                    "flag": "-s",
                    "long": "--const-subs"
                },
                {
                    "name": "-t --default-type",
                    "content": "Specify the internal type that the constant() mechanism uses for macros.  The default is\nIV (signed integer).  Currently all macros found during the header scanning process will\nbe assumed to have this type.  Future versions of \"h2xs\" may gain the ability to make\neducated guesses.\n",
                    "flag": "-t",
                    "long": "--default-type"
                },
                {
                    "name": "--use-new-tests",
                    "content": "When --compat-version (-b) is present the generated tests will use \"Test::More\" rather\nthan \"Test\" which is the default for versions before 5.6.2.  \"Test::More\" will be added\nto PREREQPM in the generated \"Makefile.PL\".\n",
                    "long": "--use-new-tests"
                },
                {
                    "name": "--use-old-tests",
                    "content": "Will force the generation of test code that uses the older \"Test\" module.\n",
                    "long": "--use-old-tests"
                },
                {
                    "name": "--skip-exporter",
                    "content": "Do not use \"Exporter\" and/or export any symbol.\n",
                    "long": "--skip-exporter"
                },
                {
                    "name": "--skip-ppport",
                    "content": "Do not use \"Devel::PPPort\": no portability to older version.\n",
                    "long": "--skip-ppport"
                },
                {
                    "name": "--skip-autoloader",
                    "content": "Do not use the module \"AutoLoader\"; but keep the constant() function and \"sub AUTOLOAD\"\nfor constants.\n",
                    "long": "--skip-autoloader"
                },
                {
                    "name": "--skip-strict",
                    "content": "Do not use the pragma \"strict\".\n",
                    "long": "--skip-strict"
                },
                {
                    "name": "--skip-warnings",
                    "content": "Do not use the pragma \"warnings\".\n",
                    "long": "--skip-warnings"
                },
                {
                    "name": "-v --version",
                    "content": "Specify a version number for this extension.  This version number is added to the\ntemplates.  The default is 0.01, or 0.0001 if \"-B\" is specified.  The version specified\nshould be numeric.\n",
                    "flag": "-v",
                    "long": "--version"
                },
                {
                    "name": "-x --autogen-xsubs",
                    "content": "Automatically generate XSUBs basing on function declarations in the header file.  The\npackage \"C::Scan\" should be installed. If this option is specified, the name of the\nheader file may look like \"NAME1,NAME2\". In this case NAME1 is used instead of the\nspecified string, but XSUBs are emitted only for the declarations included from file\nNAME2.\n\nNote that some types of arguments/return-values for functions may result in\nXSUB-declarations/typemap-entries which need hand-editing. Such may be objects which\ncannot be converted from/to a pointer (like \"long long\"), pointers to functions, or\narrays.  See also the section on \"LIMITATIONS of -x\".\n",
                    "flag": "-x",
                    "long": "--autogen-xsubs"
                }
            ]
        },
        "EXAMPLES": {
            "content": "# Default behavior, extension is Rusers\nh2xs rpcsvc/rusers\n\n# Same, but extension is RUSERS\nh2xs -n RUSERS rpcsvc/rusers\n\n# Extension is rpcsvc::rusers. Still finds <rpcsvc/rusers.h>\nh2xs rpcsvc::rusers\n\n# Extension is ONC::RPC.  Still finds <rpcsvc/rusers.h>\nh2xs -n ONC::RPC rpcsvc/rusers\n\n# Without constant() or AUTOLOAD\nh2xs -c rpcsvc/rusers\n\n# Creates templates for an extension named RPC\nh2xs -cfn RPC\n\n# Extension is ONC::RPC.\nh2xs -cfn ONC::RPC\n\n# Extension is a pure Perl module with no XS code.\nh2xs -X My::Module\n\n# Extension is Lib::Foo which works at least with Perl5.00503.\n# Constants are created for all #defines and enums h2xs can find\n# in foo.h.\nh2xs -b 5.5.3 -n Lib::Foo foo.h\n\n# Extension is Lib::Foo which works at least with Perl5.00503.\n# Constants are created for all #defines but only for enums\n# whose names do not start with 'bar'.\nh2xs -b 5.5.3 -e '^bar' -n Lib::Foo foo.h\n\n# Makefile.PL will look for library -lrpc in\n# additional directory /opt/net/lib\nh2xs rpcsvc/rusers -L/opt/net/lib -lrpc\n\n# Extension is DCE::rgynbase\n# prefix \"secrgy\" is dropped from perl function names\nh2xs -n DCE::rgynbase -p secrgy dce/rgynbase\n\n# Extension is DCE::rgynbase\n# prefix \"secrgy\" is dropped from perl function names\n# subroutines are created for secrgywildcardname and\n# secrgywildcardsid\nh2xs -n DCE::rgynbase -p secrgy \\\n-s secrgywildcardname,secrgywildcardsid dce/rgynbase\n\n# Make XS without defines in perl.h, but with function declarations\n# visible from perl.h. Name of the extension is perl1.\n# When scanning perl.h, define -DEXT=extern -DdEXT= -DINIT(x)=\n# Extra backslashes below because the string is passed to shell.\n# Note that a directory with perl header files would\n#  be added automatically to include path.\nh2xs -xAn perl1 -F \"-DEXT=extern -DdEXT= -DINIT\\(x\\)=\" perl.h\n\n# Same with function declaration in proto.h as visible from perl.h.\nh2xs -xAn perl2 perl.h,proto.h\n\n# Same but select only functions which match /^av/\nh2xs -M '^av' -xAn perl2 perl.h,proto.h\n\n# Same but treat SV* etc as \"opaque\" types\nh2xs -o '^[S]V \\*$' -M '^av' -xAn perl2 perl.h,proto.h\n\nExtension based on .h and .c files\nSuppose that you have some C files implementing some functionality, and the corresponding\nheader files.  How to create an extension which makes this functionality accessible in Perl?\nThe example below assumes that the header files are interfacesimple.h and interfacehairy.h,\nand you want the perl module be named as \"Ext::Ension\".  If you need some preprocessor\ndirectives and/or linking with external libraries, see the flags \"-F\", \"-L\" and \"-l\" in\n\"OPTIONS\".\n\nFind the directory name\nStart with a dummy run of h2xs:\n\nh2xs -Afn Ext::Ension\n\nThe only purpose of this step is to create the needed directories, and let you know the\nnames of these directories.  From the output you can see that the directory for the\nextension is Ext/Ension.\n\nCopy C files\nCopy your header files and C files to this directory Ext/Ension.\n\nCreate the extension\nRun h2xs, overwriting older autogenerated files:\n\nh2xs -Oxan Ext::Ension interfacesimple.h interfacehairy.h\n\nh2xs looks for header files after changing to the extension directory, so it will find\nyour header files OK.\n\nArchive and test\nAs usual, run\n\ncd Ext/Ension\nperl Makefile.PL\nmake dist\nmake\nmake test\n\nHints\nIt is important to do \"make dist\" as early as possible.  This way you can easily merge(1)\nyour changes to autogenerated files if you decide to edit your \".h\" files and rerun h2xs.\n\nDo not forget to edit the documentation in the generated .pm file.\n\nConsider the autogenerated files as skeletons only, you may invent better interfaces than\nwhat h2xs could guess.\n\nConsider this section as a guideline only, some other options of h2xs may better suit\nyour needs.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "No environment variables are used.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Larry Wall and others\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl, perlxstut, ExtUtils::MakeMaker, and AutoLoader.\n",
            "subsections": []
        },
        "DIAGNOSTICS": {
            "content": "The usual warnings if it cannot read or write the files involved.\n",
            "subsections": [
                {
                    "name": "LIMITATIONS of -x",
                    "content": "h2xs would not distinguish whether an argument to a C function which is of the form, say,\n\"int *\", is an input, output, or input/output parameter.  In particular, argument\ndeclarations of the form\n\nint\nfoo(n)\nint *n\n\nshould be better rewritten as\n\nint\nfoo(n)\nint &n\n\nif \"n\" is an input parameter.\n\nAdditionally, h2xs has no facilities to intuit that a function\n\nint\nfoo(addr,l)\nchar *addr\nint   l\n\ntakes a pair of address and length of data at this address, so it is better to rewrite this\nfunction as\n\nint\nfoo(sv)\nSV *addr\nPREINIT:\nSTRLEN len;\nchar *s;\nCODE:\ns = SvPV(sv,len);\nRETVAL = foo(s, len);\nOUTPUT:\nRETVAL\n\nor alternately\n\nstatic int\nmyfoo(SV *sv)\n{\nSTRLEN len;\nchar *s = SvPV(sv,len);\n\nreturn foo(s, len);\n}\n\nMODULE = foo        PACKAGE = foo   PREFIX = my\n\nint\nfoo(sv)\nSV *sv\n\nSee perlxs and perlxstut for additional details.\n\n\n\nperl v5.34.0                                 2025-07-25                                      H2XS(1)"
                }
            ]
        }
    },
    "summary": "h2xs - convert .h C header files to Perl extensions",
    "flags": [
        {
            "flag": "-A",
            "long": "--omit-autoload",
            "arg": null,
            "description": "Omit all autoload facilities. This is the same as -c but also removes the \"use AutoLoader\" statement from the .pm file."
        },
        {
            "flag": "-B",
            "long": "--beta-version",
            "arg": null,
            "description": "Use an alpha/beta style version number. Causes version number to be \"0.0001\" unless -v is specified."
        },
        {
            "flag": "-C",
            "long": "--omit-changes",
            "arg": null,
            "description": "Omits creation of the Changes file, and adds a HISTORY section to the POD template."
        },
        {
            "flag": "-F",
            "long": "--cpp-flags",
            "arg": null,
            "description": "Additional flags to specify to C preprocessor when scanning header for function declarations. Writes these options in the generated Makefile.PL too."
        },
        {
            "flag": "-M",
            "long": "--func-mask",
            "arg": null,
            "description": "selects functions/macros to process."
        },
        {
            "flag": "-O",
            "long": "--overwrite-ok",
            "arg": null,
            "description": "Allows a pre-existing extension directory to be overwritten."
        },
        {
            "flag": "-P",
            "long": "--omit-pod",
            "arg": null,
            "description": "Omit the autogenerated stub POD section."
        },
        {
            "flag": "-X",
            "long": "--omit-XS",
            "arg": null,
            "description": "Omit the XS portion. Used to generate a skeleton pure Perl module. \"-c\" and \"-f\" are implicitly enabled."
        },
        {
            "flag": "-a",
            "long": "--gen-accessors",
            "arg": null,
            "description": "Generate an accessor method for each element of structs and unions. The generated methods are named after the element name; will return the current value of the element if called without additional arguments; and will set the element to the supplied value (and return the new value) if called with an additional argument. Embedded structures and unions are returned as a pointer rather than the complete structure, to facilitate chained calls. These methods all apply to the Ptr type for the structure; additionally two methods are constructed for the structure type itself, \"toptr\" which returns a Ptr type pointing to the same structure, and a \"new\" method to construct and return a new structure, initialised to zeroes."
        },
        {
            "flag": "-b",
            "long": "--compat-version",
            "arg": null,
            "description": "Generates a .pm file which is backwards compatible with the specified perl version. For versions < 5.6.0, the changes are. - no use of 'our' (uses 'use vars' instead) - no 'use warnings' Specifying a compatibility version higher than the version of perl you are using to run h2xs will have no effect. If unspecified h2xs will default to compatibility with the version of perl you are using to run h2xs."
        },
        {
            "flag": "-c",
            "long": "--omit-constant",
            "arg": null,
            "description": "Omit \"constant()\" from the .xs file and corresponding specialised \"AUTOLOAD\" from the .pm file."
        },
        {
            "flag": "-d",
            "long": "--debugging",
            "arg": null,
            "description": "Turn on debugging messages."
        },
        {
            "flag": "-e",
            "long": "--omit-enums",
            "arg": null,
            "description": "If regular expression is not given, skip all constants that are defined in a C enumeration. Otherwise skip only those constants that are defined in an enum whose name matches regular expression. Since regular expression is optional, make sure that this switch is followed by at least one other switch if you omit regular expression and have some pending arguments such as header-file names. This is ok: h2xs -e -n Module::Foo foo.h This is not ok: h2xs -n Module::Foo -e foo.h In the latter, foo.h is taken as regular expression."
        },
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "Allows an extension to be created for a header even if that header is not found in standard include directories."
        },
        {
            "flag": "-g",
            "long": "--global",
            "arg": null,
            "description": "Include code for safely storing static data in the .xs file. Extensions that do no make use of static data can ignore this option."
        },
        {
            "flag": "-?",
            "long": "--help",
            "arg": null,
            "description": "Print the usage, help and version for this h2xs and exit."
        },
        {
            "flag": "-k",
            "long": "--omit-const-func",
            "arg": null,
            "description": "For function arguments declared as \"const\", omit the const attribute in the generated XS code."
        },
        {
            "flag": "-m",
            "long": "--gen-tied-var",
            "arg": null,
            "description": "Experimental: for each variable declared in the header file(s), declare a perl variable of the same name magically tied to the C variable."
        },
        {
            "flag": "-n",
            "long": "--name",
            "arg": null,
            "description": "Specifies a name to be used for the extension, e.g., -n RPC::DCE"
        },
        {
            "flag": "-o",
            "long": "--opaque-re",
            "arg": null,
            "description": "Use \"opaque\" data type for the C types matched by the regular expression, even if these types are \"typedef\"-equivalent to types from typemaps. Should not be used without -x. This may be useful since, say, types which are \"typedef\"-equivalent to integers may represent OS-related handles, and one may want to work with these handles in OO-way, as in \"$handle->dosomething()\". Use \"-o .\" if you want to handle all the \"typedef\"ed types as opaque types. The type-to-match is whitewashed (except for commas, which have no whitespace before them, and multiple \"*\" which have no whitespace between them)."
        },
        {
            "flag": "-p",
            "long": "--remove-prefix",
            "arg": null,
            "description": "Specify a prefix which should be removed from the Perl function names, e.g., -p secrgy This sets up the XS PREFIX keyword and removes the prefix from functions that are autoloaded via the \"constant()\" mechanism."
        },
        {
            "flag": "-s",
            "long": "--const-subs",
            "arg": null,
            "description": "Create a perl subroutine for the specified macros rather than autoload with the constant() subroutine. These macros are assumed to have a return type of char *, e.g., -s secrgywildcardname,secrgywildcardsid."
        },
        {
            "flag": "-t",
            "long": "--default-type",
            "arg": null,
            "description": "Specify the internal type that the constant() mechanism uses for macros. The default is IV (signed integer). Currently all macros found during the header scanning process will be assumed to have this type. Future versions of \"h2xs\" may gain the ability to make educated guesses."
        },
        {
            "flag": "",
            "long": "--use-new-tests",
            "arg": null,
            "description": "When --compat-version (-b) is present the generated tests will use \"Test::More\" rather than \"Test\" which is the default for versions before 5.6.2. \"Test::More\" will be added to PREREQPM in the generated \"Makefile.PL\"."
        },
        {
            "flag": "",
            "long": "--use-old-tests",
            "arg": null,
            "description": "Will force the generation of test code that uses the older \"Test\" module."
        },
        {
            "flag": "",
            "long": "--skip-exporter",
            "arg": null,
            "description": "Do not use \"Exporter\" and/or export any symbol."
        },
        {
            "flag": "",
            "long": "--skip-ppport",
            "arg": null,
            "description": "Do not use \"Devel::PPPort\": no portability to older version."
        },
        {
            "flag": "",
            "long": "--skip-autoloader",
            "arg": null,
            "description": "Do not use the module \"AutoLoader\"; but keep the constant() function and \"sub AUTOLOAD\" for constants."
        },
        {
            "flag": "",
            "long": "--skip-strict",
            "arg": null,
            "description": "Do not use the pragma \"strict\"."
        },
        {
            "flag": "",
            "long": "--skip-warnings",
            "arg": null,
            "description": "Do not use the pragma \"warnings\"."
        },
        {
            "flag": "-v",
            "long": "--version",
            "arg": null,
            "description": "Specify a version number for this extension. This version number is added to the templates. The default is 0.01, or 0.0001 if \"-B\" is specified. The version specified should be numeric."
        },
        {
            "flag": "-x",
            "long": "--autogen-xsubs",
            "arg": null,
            "description": "Automatically generate XSUBs basing on function declarations in the header file. The package \"C::Scan\" should be installed. If this option is specified, the name of the header file may look like \"NAME1,NAME2\". In this case NAME1 is used instead of the specified string, but XSUBs are emitted only for the declarations included from file NAME2. Note that some types of arguments/return-values for functions may result in XSUB-declarations/typemap-entries which need hand-editing. Such may be objects which cannot be converted from/to a pointer (like \"long long\"), pointers to functions, or arrays. See also the section on \"LIMITATIONS of -x\"."
        }
    ],
    "examples": [
        "# Default behavior, extension is Rusers",
        "h2xs rpcsvc/rusers",
        "# Same, but extension is RUSERS",
        "h2xs -n RUSERS rpcsvc/rusers",
        "# Extension is rpcsvc::rusers. Still finds <rpcsvc/rusers.h>",
        "h2xs rpcsvc::rusers",
        "# Extension is ONC::RPC.  Still finds <rpcsvc/rusers.h>",
        "h2xs -n ONC::RPC rpcsvc/rusers",
        "# Without constant() or AUTOLOAD",
        "h2xs -c rpcsvc/rusers",
        "# Creates templates for an extension named RPC",
        "h2xs -cfn RPC",
        "# Extension is ONC::RPC.",
        "h2xs -cfn ONC::RPC",
        "# Extension is a pure Perl module with no XS code.",
        "h2xs -X My::Module",
        "# Extension is Lib::Foo which works at least with Perl5.00503.",
        "# Constants are created for all #defines and enums h2xs can find",
        "# in foo.h.",
        "h2xs -b 5.5.3 -n Lib::Foo foo.h",
        "# Extension is Lib::Foo which works at least with Perl5.00503.",
        "# Constants are created for all #defines but only for enums",
        "# whose names do not start with 'bar'.",
        "h2xs -b 5.5.3 -e '^bar' -n Lib::Foo foo.h",
        "# Makefile.PL will look for library -lrpc in",
        "# additional directory /opt/net/lib",
        "h2xs rpcsvc/rusers -L/opt/net/lib -lrpc",
        "# Extension is DCE::rgynbase",
        "# prefix \"secrgy\" is dropped from perl function names",
        "h2xs -n DCE::rgynbase -p secrgy dce/rgynbase",
        "# Extension is DCE::rgynbase",
        "# prefix \"secrgy\" is dropped from perl function names",
        "# subroutines are created for secrgywildcardname and",
        "# secrgywildcardsid",
        "h2xs -n DCE::rgynbase -p secrgy \\",
        "-s secrgywildcardname,secrgywildcardsid dce/rgynbase",
        "# Make XS without defines in perl.h, but with function declarations",
        "# visible from perl.h. Name of the extension is perl1.",
        "# When scanning perl.h, define -DEXT=extern -DdEXT= -DINIT(x)=",
        "# Extra backslashes below because the string is passed to shell.",
        "# Note that a directory with perl header files would",
        "#  be added automatically to include path.",
        "h2xs -xAn perl1 -F \"-DEXT=extern -DdEXT= -DINIT\\(x\\)=\" perl.h",
        "# Same with function declaration in proto.h as visible from perl.h.",
        "h2xs -xAn perl2 perl.h,proto.h",
        "# Same but select only functions which match /^av/",
        "h2xs -M '^av' -xAn perl2 perl.h,proto.h",
        "# Same but treat SV* etc as \"opaque\" types",
        "h2xs -o '^[S]V \\*$' -M '^av' -xAn perl2 perl.h,proto.h",
        "Extension based on .h and .c files",
        "Suppose that you have some C files implementing some functionality, and the corresponding",
        "header files.  How to create an extension which makes this functionality accessible in Perl?",
        "The example below assumes that the header files are interfacesimple.h and interfacehairy.h,",
        "and you want the perl module be named as \"Ext::Ension\".  If you need some preprocessor",
        "directives and/or linking with external libraries, see the flags \"-F\", \"-L\" and \"-l\" in",
        "\"OPTIONS\".",
        "Find the directory name",
        "Start with a dummy run of h2xs:",
        "h2xs -Afn Ext::Ension",
        "The only purpose of this step is to create the needed directories, and let you know the",
        "names of these directories.  From the output you can see that the directory for the",
        "extension is Ext/Ension.",
        "Copy C files",
        "Copy your header files and C files to this directory Ext/Ension.",
        "Create the extension",
        "Run h2xs, overwriting older autogenerated files:",
        "h2xs -Oxan Ext::Ension interfacesimple.h interfacehairy.h",
        "h2xs looks for header files after changing to the extension directory, so it will find",
        "your header files OK.",
        "Archive and test",
        "As usual, run",
        "cd Ext/Ension",
        "perl Makefile.PL",
        "make dist",
        "make",
        "make test",
        "Hints",
        "It is important to do \"make dist\" as early as possible.  This way you can easily merge(1)",
        "your changes to autogenerated files if you decide to edit your \".h\" files and rerun h2xs.",
        "Do not forget to edit the documentation in the generated .pm file.",
        "Consider the autogenerated files as skeletons only, you may invent better interfaces than",
        "what h2xs could guess.",
        "Consider this section as a guideline only, some other options of h2xs may better suit",
        "your needs."
    ],
    "see_also": []
}