Skip to content
This repository

Perl Module: Inline::CPP: Include C++ code inline within Perl code.

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 grammar
Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CPP.pm
Octocat-spinner-32 Changes
Octocat-spinner-32 MANIFEST
Octocat-spinner-32 MANIFEST.SKIP
Octocat-spinner-32 META.json
Octocat-spinner-32 META.yml
Octocat-spinner-32 Makefile.PL
Octocat-spinner-32 README
Octocat-spinner-32 TESTED
README
INTRODUCTION:

Inline::CPP -- Write Perl subroutines and classes in C++.

Inline::CPP lets you write Perl subroutines and classes in C++. You
don't have to learn XS or SWIG, you can just put code right "inline"
in your source.

Example:

   use Inline CPP => <<'END';

   class JAxH {
     public:
       JAxH(char *x);

       SV* data();
     private:
       SV *dat;
   };

   JAxH::JAxH(char *x) { dat = newSVpvf("Just Another %s Hacker", x); }
   SV* JAxH::data() { return dat; }

   END

   print JAxH->new('Inline')->data(), "\n";

When run, this complete program prints:

   Just Another Inline Hacker.


-----------------------------------------------------------------------------
INSTALLATION:

It should go without saying, but you will need a C++ compiler on your system.
The C++ compiler should be of the same flavor as the C compiler used to build
perl itself.  If you're using GNU C++, be sure that you have the g++ front
end installed (it isn't installed by default on some Linux distros, for
example).  If you cannot execute 'g++ -v' from the command prompt, or some
variation for your specific C++ compiler,

*** DISABLE HARNESS_OPTIONS=j9 ***

If you have the HARNESS_OPTIONS environment variable set to run tests 
concurrently in multiple processes, the test suite will attempt to invoke
the C++ compiler multiple times concurrently.  We're finding that this option
is incompatible with Inline::CPP, and the compilation process is too complex
to work out why without considerable effort.

Also, some smoke testers run their testing in parallel, which has a similar
negative effect, and results in FAIL reports for reasons that will never
occur in the real world.

This module requires Inline::C.pm version 0.53 or higher to be installed.
It also uses Parse::RecDescent, and a new-ish version of ExtUtils::MakeMaker.

To install Inline::CPP do this:

perl Makefile.PL
make
make test
make install

(On ActivePerl for MSWin32, use nmake instead of make.)
(On Strawberry Perl you may use dmake instead.)

As Makefile.PL runs you will be prompted for what C++ compiler and library to
use.  Accepting the default should work in nearly every case (and if it
doesn't, let me know).

-----------------------------------------------------------------------------
INFORMATION:

- For more information on Inline::CPP see 'perldoc Inline::CPP'.
- For information about Inline.pm, see 'perldoc Inline'.
- For information about Inline::C (of which this is a subclass)
  see 'perldoc Inline::C', as well as 'perldoc Inline::C-Cookbook'.
- For information on using Perl with C or C++, see 'perldoc perlapi'

The Inline mailing list is inline@perl.org. Send mail to
inline-subscribe@perl.org to subscribe.

This module's development is under version control with Git, hosted on Github
at https://github.com/daoswald/Inline-CPP

Please send questions and comments to "David Oswald" <DAVIDO@cpan.org>

Copyright (c) 2003 - 2013, Neil Watkiss, David Oswald. All Rights Reserved.
Something went wrong with that request. Please try again.