{
    "content": [
        {
            "type": "text",
            "text": "# XSLoader (man)\n\n## NAME\n\nXSLoader - Dynamically load C libraries into Perl code\n\n## SYNOPSIS\n\npackage YourPackage;\nrequire XSLoader;\nXSLoader::load(PACKAGE, $VERSION);\n\n## DESCRIPTION\n\nThis module defines a standard simplified interface to the dynamic linking mechanisms\navailable on many platforms.  Its primary purpose is to implement cheap automatic dynamic\nloading of Perl modules.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION** (4 subsections)\n- **DIAGNOSTICS**\n- **LIMITATIONS**\n- **KNOWN BUGS**\n- **BUGS**\n- **SEE ALSO**\n- **AUTHORS** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "XSLoader",
        "section": "",
        "mode": "man",
        "summary": "XSLoader - Dynamically load C libraries into Perl code",
        "synopsis": "package YourPackage;\nrequire XSLoader;\nXSLoader::load(PACKAGE, $VERSION);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": [
                    {
                        "name": "Migration from \"DynaLoader\"",
                        "lines": 40
                    },
                    {
                        "name": "Backward compatible boilerplate",
                        "lines": 23
                    },
                    {
                        "name": "Order of initialization: early load()",
                        "lines": 44
                    },
                    {
                        "name": "The most hairy case",
                        "lines": 22
                    }
                ]
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "LIMITATIONS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "KNOWN BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 6,
                "subsections": [
                    {
                        "name": "COPYRIGHT & LICENSE",
                        "lines": 8
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "XSLoader - Dynamically load C libraries into Perl code\n",
                "subsections": []
            },
            "VERSION": {
                "content": "Version 0.30\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package YourPackage;\nrequire XSLoader;\n\nXSLoader::load(PACKAGE, $VERSION);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module defines a standard simplified interface to the dynamic linking mechanisms\navailable on many platforms.  Its primary purpose is to implement cheap automatic dynamic\nloading of Perl modules.\n\nFor a more complicated interface, see DynaLoader.  Many (most) features of \"DynaLoader\" are\nnot implemented in \"XSLoader\", like for example the \"dlloadflags\", not honored by\n\"XSLoader\".\n",
                "subsections": [
                    {
                        "name": "Migration from \"DynaLoader\"",
                        "content": "A typical module using DynaLoader starts like this:\n\npackage YourPackage;\nrequire DynaLoader;\n\nour @ISA = qw( OnePackage OtherPackage DynaLoader );\nour $VERSION = '0.01';\nPACKAGE->bootstrap($VERSION);\n\nChange this to\n\npackage YourPackage;\nuse XSLoader;\n\nour @ISA = qw( OnePackage OtherPackage );\nour $VERSION = '0.01';\nXSLoader::load(PACKAGE, $VERSION);\n\nIn other words: replace \"require DynaLoader\" by \"use XSLoader\", remove \"DynaLoader\" from\n@ISA, change \"bootstrap\" by \"XSLoader::load\".  Do not forget to quote the name of your\npackage on the \"XSLoader::load\" line, and add comma (\",\") before the arguments ($VERSION\nabove).\n\nOf course, if @ISA contained only \"DynaLoader\", there is no need to have the @ISA assignment\nat all; moreover, if instead of \"our\" one uses the more backward-compatible\n\nuse vars qw($VERSION @ISA);\n\none can remove this reference to @ISA together with the @ISA assignment.\n\nIf no $VERSION was specified on the \"bootstrap\" line, the last line becomes\n\nXSLoader::load(PACKAGE);\n\nin which case it can be further simplified to\n\nXSLoader::load();\n\nas \"load\" will use \"caller\" to determine the package.\n"
                    },
                    {
                        "name": "Backward compatible boilerplate",
                        "content": "If you want to have your cake and eat it too, you need a more complicated boilerplate.\n\npackage YourPackage;\n\nour @ISA = qw( OnePackage OtherPackage );\nour $VERSION = '0.01';\neval {\nrequire XSLoader;\nXSLoader::load(PACKAGE, $VERSION);\n1;\n} or do {\nrequire DynaLoader;\npush @ISA, 'DynaLoader';\nPACKAGE->bootstrap($VERSION);\n};\n\nThe parentheses about \"XSLoader::load()\" arguments are needed since we replaced \"use\nXSLoader\" by \"require\", so the compiler does not know that a function \"XSLoader::load()\" is\npresent.\n\nThis boilerplate uses the low-overhead \"XSLoader\" if present; if used with an antique Perl\nwhich has no \"XSLoader\", it falls back to using \"DynaLoader\".\n"
                    },
                    {
                        "name": "Order of initialization: early load()",
                        "content": "Skip this section if the XSUB functions are supposed to be called from other modules only;\nread it only if you call your XSUBs from the code in your module, or have a \"BOOT:\" section\nin your XS file (see \"The BOOT: Keyword\" in perlxs).  What is described here is equally\napplicable to the DynaLoader interface.\n\nA sufficiently complicated module using XS would have both Perl code (defined in\nYourPackage.pm) and XS code (defined in YourPackage.xs).  If this Perl code makes calls into\nthis XS code, and/or this XS code makes calls to the Perl code, one should be careful with\nthe order of initialization.\n\nThe call to \"XSLoader::load()\" (or \"bootstrap()\") calls the module's bootstrap code. For\nmodules build by xsubpp (nearly all modules) this has three side effects:\n\n•   A sanity check is done to ensure that the versions of the .pm and the (compiled) .xs\nparts are compatible. If $VERSION was specified, this is used for the check. If not\nspecified, it defaults to \"$XSVERSION // $VERSION\" (in the module's namespace)\n\n•   the XSUBs are made accessible from Perl\n\n•   if a \"BOOT:\" section was present in the .xs file, the code there is called.\n\nConsequently, if the code in the .pm file makes calls to these XSUBs, it is convenient to\nhave XSUBs installed before the Perl code is defined; for example, this makes prototypes for\nXSUBs visible to this Perl code.  Alternatively, if the \"BOOT:\" section makes calls to Perl\nfunctions (or uses Perl variables) defined in the .pm file, they must be defined prior to the\ncall to \"XSLoader::load()\" (or \"bootstrap()\").\n\nThe first situation being much more frequent, it makes sense to rewrite the boilerplate as\n\npackage YourPackage;\nuse XSLoader;\nour ($VERSION, @ISA);\n\nBEGIN {\n@ISA = qw( OnePackage OtherPackage );\n$VERSION = '0.01';\n\n# Put Perl code used in the BOOT: section here\n\nXSLoader::load(PACKAGE, $VERSION);\n}\n\n# Put Perl code making calls into XSUBs here\n"
                    },
                    {
                        "name": "The most hairy case",
                        "content": "If the interdependence of your \"BOOT:\" section and Perl code is more complicated than this\n(e.g., the \"BOOT:\" section makes calls to Perl functions which make calls to XSUBs with\nprototypes), get rid of the \"BOOT:\" section altogether.  Replace it with a function\n\"onBOOT()\", and call it like this:\n\npackage YourPackage;\nuse XSLoader;\nour ($VERSION, @ISA);\n\nBEGIN {\n@ISA = qw( OnePackage OtherPackage );\n$VERSION = '0.01';\nXSLoader::load(PACKAGE, $VERSION);\n}\n\n# Put Perl code used in onBOOT() function here; calls to XSUBs are\n# prototype-checked.\n\nonBOOT;\n\n# Put Perl initialization code assuming that XS is initialized here\n"
                    }
                ]
            },
            "DIAGNOSTICS": {
                "content": "\"Can't find '%s' symbol in %s\"\n(F) The bootstrap symbol could not be found in the extension module.\n\n\"Can't load '%s' for module %s: %s\"\n(F) The loading or initialisation of the extension module failed.  The detailed error\nfollows.\n\n\"Undefined symbols present after loading %s: %s\"\n(W) As the message says, some symbols stay undefined although the extension module was\ncorrectly loaded and initialised. The list of undefined symbols follows.\n",
                "subsections": []
            },
            "LIMITATIONS": {
                "content": "To reduce the overhead as much as possible, only one possible location is checked to find the\nextension DLL (this location is where \"make install\" would put the DLL).  If not found, the\nsearch for the DLL is transparently delegated to \"DynaLoader\", which looks for the DLL along\nthe @INC list.\n\nIn particular, this is applicable to the structure of @INC used for testing not-yet-installed\nextensions.  This means that running uninstalled extensions may have much more overhead than\nrunning the same extensions after \"make install\".\n",
                "subsections": []
            },
            "KNOWN BUGS": {
                "content": "The new simpler way to call \"XSLoader::load()\" with no arguments at all does not work on Perl\n5.8.4 and 5.8.5.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Please report any bugs or feature requests via the perlbug(1) utility.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "DynaLoader\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Ilya Zakharevich originally extracted \"XSLoader\" from \"DynaLoader\".\n\nCPAN version is currently maintained by Sébastien Aperghis-Tramoni <sebastien@aperghis.net>.\n\nPrevious maintainer was Michael G Schwern <schwern@pobox.com>.\n",
                "subsections": [
                    {
                        "name": "COPYRIGHT & LICENSE",
                        "content": "Copyright (C) 1990-2011 by Larry Wall and others.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms\nas Perl itself.\n\n\n\nperl v5.34.0                                 2025-07-25                              XSLoader(3perl)"
                    }
                ]
            }
        }
    }
}