|PerlStream << C++ and Perl
[ Home ]
Integration of Perl into C++
NEW! PerlStream has its own website at http://perlstream.tigris.org
Embedding a Perl interpreter into a C++ program can be a powerful strategy - especially when existing C++ code required advanced text handling capabilities - something that native C++ code does not excel at. Nonetheless, the C API exposed by the Perl interpreter, documented in perlapi and perlembed is not for the faint hearted - and isn't conducive to rapidly embedding some Perl code into a C++ program.
The January 2002 edition of the C/C++ User's Journal (CUJ) contained an article by Robert Y. Seward called A stream class for calling Perl from C++, describing the implementation of a stream interface to an underlying instance of the Perl interpreter, allowing Perl source code to be streamed directly to the Perl interpreter and executed. The code from CUJ was subsequently modified by Will Nolan to fix minor bugs and make it work on his Sun Forte compiler.
Since using a modified version of the magazine code for professional
purposes, I've since undertaken a complete re-write of PerlStream, and
it now has its own website at
The code presented allows simple use of Perl code from C++. You will also need the Perl source code and the tools to compile it on your system.
Internet links :
Last updated 2005-05-09 © R J Smallshire