Home: Perl Programming Help: Advanced:
Need help to call perl module from C/C++ code without loading the perl libraries



muraliv
New User

Oct 2, 2012, 4:10 AM


Views: 7556
Need help to call perl module from C/C++ code without loading the perl libraries

Hi,

I am new to perl. I have a requirement to call a perl module from C/C++ code without loading the perl libraries. I am not supposed to use the "system" call also. I am looking something similar to "dlopen" call which we use to load the shared libraries dynamically from a C/C++ code. Basically I wanted to keep perl and C/C++ code independently. Generally we can embed the perl into C/C++ code by including the include files EXTERN.h and perl.h. While compiling the C/C++ code, we need to provide the perl libraries. As per my requirement, I am not supposed to provide any perl libraries while compiling the C/C++ code.

Any idea how to call perl module from C/C++ code without loading the perl libraries other than “system” call?

Thanks in advance.

Regards,
Murali


wickedxter
User

Oct 2, 2012, 12:34 PM


Views: 7543
Re: [muraliv] Need help to call perl module from C/C++ code without loading the perl libraries

I dont know nothing about c/c++ but i found this information that might help. http://perldoc.perl.org/perlxs.html


(This post was edited by wickedxter on Oct 2, 2012, 12:36 PM)


Laurent_R
Veteran / Moderator

Oct 2, 2012, 2:19 PM


Views: 7538
Re: [wickedxter] Need help to call perl module from C/C++ code without loading the perl libraries

Hmm, XS is more to work your route the other way around: writing a C or C++ extension to a Perl program.

The OP wants to write a Perl extension to a C program. I know that this is possible, but I have never done it, so I can't help much. But my understanding of what I quickly read on the subject was that you have to include the perl libraries. So, no idea on how to do it without including the libraries.


wickedxter
User

Oct 3, 2012, 1:59 PM


Views: 7518
Re: [muraliv] Need help to call perl module from C/C++ code without loading the perl libraries

http://docstore.mik.ua/orelly/perl/prog3/ch21_04.htm