Search code examples
perlperl-modulexs

Perl XS and Inline::C


What's the difference between using XS and the Inline::C module? This was mentioned by someone in this question and has made me curious.


Solution

  • Inline::C generates XS and builds the generated module. It does this at run-time, although it caches past builds.

    Inline::C is possibly easier to use, but there are a few downsides. The first time it runs, it slows down startup, it requires permissions to create files at run-time, and it requires the tools to compile the module. Furthermore, it makes it harder for a sysadmin to install.

    The upside is that you can grab the generated XS and eliminate Inline::C once things start shaping up. This makes it useful for prototyping.