Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to call C++ from perl

by halley (Prior)
on Apr 19, 2004 at 18:51 UTC ( [id://346404]=note: print w/replies, xml ) Need Help??


in reply to How to call C++ from perl

Your best bet would be to make a C routine (with extern "C" declaration) which can call your C++ routine properly. Calling C++ directly is a bit of an issue thanks to a problem called "decoration" which is difficult to manage from any other language. Then your Perl can call the simple C functions in a fairly straightforward way.

To see more about how to call C from Perl, see perlxs and perlguts. The inverse, how to call Perl from C, you can find in perlembed.

Update: Inline::CPP is another option, but requires you to compile the code when you run the script. This may or may not be convenient for your scripting and distribution purposes.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://346404]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-23 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found