11.10. How do I call perl from C?

You need to see a recent copy of the perlembed(1) pod page. By "recent" it needs to be up to date with at least perl5.002.

Borrowing from Jon Orwant's preamble to that document:

Do you want to:

Use C from Perl?
Read (at least) the perlcall(1), the perlapi(1), the perlxs(1), the perlxstut(1), and the perlguts(1) manpages.
Use C++ from Perl?
Recent changes to MakeMaker will make this easier. Be sure you are familiar with the perlcall(1), the perlapi(1), the perlxs(1), the perlxstut(1), and the perlguts(1) manpages.
Use an executable program from Perl?
Read about backquotes ``, system(), and exec() built in perl functions. Try reading the perlfunc(1) manpage.
Use Perl from Perl?
Read about do, eval, use and require. The perlfunc(1) manpage discusses these. For complete scripts you may also make use of the backquotes ``, system(), or exec() built in perl functions, but you may take a performance hit in doing so (see perlfunc(1) for information).
Use C from C?
Rethink your design.
Use C++ from C++?
See previous.
Use Perl from C?
Read (at least) the perlembed(1) and the perlguts(1) manpages.
Use Perl from C++?
Read (at least) the perlembed(1) and the perlguts(1) manpages.
There is also an Doug MacEachern's <dougm@osf.org> embedder's development kit on CPAN and at a URL of the following form:
    http://www.osf.org/~dougm/perl/Devel-embed-*.tar.gz

Previous | Return to table of contents | Next