C::Blocks::PerlAPI - C interface for interacting with Perl
use strict; use warnings; use C::Blocks; use C::Blocks::PerlAPI; cshare { void say_hi() { PerlIO_stdoutf("hi!"); } }
This C::Blocks module provides access to the Perl C library. It is roughly equivalent to including these lines at the top of your cblocks:
#define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h"
as well as linking to libperl. Of course, as a C::Blocks module, it also avoids the re-parsing necessary if you were to include those at the top of each of your cblocks.
The Perl C library is vast, and a tutorial for it may be useful at some point. Until that time, I will simply refer you to perlapi and perlguts.
To install C::Blocks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm C::Blocks
CPAN shell
perl -MCPAN -e shell install C::Blocks
For more information on module installation, please visit the detailed CPAN module installation guide.