On Aug 19, 2014, at 9:12 AM, Manuel Reimer wrote:

> Hello,
> 
> there are many very good examples on how to execute perl code from C. For 
> example the following tutorial is very helpful:
> 
> http://perldoc.perl.org/perlembed.html
> 
> But it only shows calling from C to perl.
> 
> What I want to do is to create a function in C code and somehow export it to 
> my embedded perl interpreter. Then I want to be able to call this C function 
> from perl code.
> 
> Can someone point me to a good example on how to do this?
> 
> Thank you very much in advance.
> 
> Greetings,
> 
> Manuel

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.

There is a tutorial about XS at the same website (or via the perldoc 
command-line program):

<http://perldoc.perl.org/perlxstut.html>

Good luck!


--
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