LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   calling C/C++ function from perl (https://www.linuxquestions.org/questions/linux-newbie-8/calling-c-c-function-from-perl-713119/)

cpp2quser 03-20-2009 09:10 AM

calling C/C++ function from perl
 
calling C/C++ function from perl

Hi,
how do I call a compiled C/C++ function from perl ?
Let say I have a C/C++ function:

Code:

*char func(char *ptr, int len) {
    ...
return str;}

Now i wonna call it from perl

TB0ne 03-21-2009 03:42 PM

Quote:

Originally Posted by cpp2quser (Post 3482088)
calling C/C++ function from perl

Hi,
how do I call a compiled C/C++ function from perl ?
Let say I have a C/C++ function:

Code:

*char func(char *ptr, int len) {
    ...
return str;}

Now i wonna call it from perl

Inline-0.44 from CPAN (which includes Inline::C), and there's also Inline::CPP. Or you may like to get straight into compiling XS code (which is more or less what Inline::C automates for you) - in which case you'd probably start with 'perldoc perlxstut'.

You can also look at http://www.swig.org It is "a relatively quick and painless way of exposing your C/C++ program's internal API to the machinations of any scripting language."

And since you're into programming, spelling correctly would certainly help too. :)


All times are GMT -5. The time now is 02:11 AM.