On 08/19/2014 06:58 PM, Jim Gibson wrote:
Calling a C program from Perl can be done with the XS mechanism. XS stands for 
eXternal Subroutine, and is the most common way to provide Perl-to-C linkage. 
However, you may need to learn something about Perl internals.

I know some basics about XS and I've written some small modules to get access to C functions that aren't available in plain Perl.

I've also successfully written my own small example program that calls a perl script in an embedded interpreter.

What I'm missing is the glue between both worlds.

Is it possible to embed a perl interpreter in a C program, which itself defines a function "Foobar" which is declared in "foobar.h". Now I use the same "foobar.h" in a XS perl module to use this C interface. Is it possible to make my "module" interact with the function defined in the C program that embeds the interpreter?

The idea is to somehow embed a perl interpreter into some software which only allows C to be used to write plugins. Those plugins are small ".so" files that have to use some header files which define the API. I somehow want to export the plugin API "into the Perl world" to make it possible to write plugins in Perl.

Greetings,

Manuel


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to