Call perl program from C

I've been trying to call a perl program (an entire program not just a subroutine)and I really don't want to use call() or any exec() functions as I'd like to not have to initialize the perl interpreter each time this program is called.

I've looked at the perlembed stuff but all I can find is ways to call subs or functions not entire programs.

Can anyone help with a link to some sample code? or some suggestions with where to start?

Thank you in advance.


  • Well, this post is rather old. I am returning to Programmers Heaven, so I just saw it.

    Ok, my sugesstion is that you could create two pipe files. You would perform this outside from your program. You can see how [link=]here[/link].

    Then, you will start the execution of your Perl script and instruct it to read/write from/to the pipes that you created. In your C program, you will open both pipes too. Then, all the communication between the perl script and C executable will happen through the pipes. You need to start the perl script only once (I don't know how the script or, to tell the truth, how Perl works).

    Hope it helps!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion