OverviewINLINE::C[1] PROVIDES a new way to write Perl modules with C. Instead of separating out the Perl and C parts of your module into different files, you can include them both in the same file. Instead of learning a new programming language (XS), you can create C functions in pure C. If this sounds pretty great, it is! My prediction is that the majority of new C modules will be written using Inline::C. It's easy, it works, and what more could you ask for? Inline::C is essentially a compiler for XS. You give Inline::C some C code. Inline::C takes that code, parses it, and produces an XS wrapper to make that code callable from Perl. This XS code is written out to disk in a special temporary directory. Then Inline::C compiles the code using the normal XS tools: ExtUtils::MakeMaker, xsubpp, and your system's C compiler This compiled code is saved to disk and then loaded into memory. Since the compiled code is saved to disk, it can be reused as long as the C code hasn't changed. This magic is accomplished by using Digest::MD5 to produce a fingerprint of your code. When that fingerprint is changed, the code is automatically recompiled the next time it's passed to Inline::C.
[1]Written by Brian Ingerson and available on a CPAN mirror near you |