suryakiran has asked for the wisdom of the Perl Monks concerning the following question:
I've an application, which is made up of quite a number of shared libraries. I've written perl extensions to some of them. Also, I've embedded perl into the application.
I'm calling a perl script from with in C++. Lets say, my perl extensions are named as SV::Net::Info and SV::Interface and my perl file is looking like this
use SV::Net::Info; use SV::Interface; #use IO::Socket; ... ... ...
I'm able to read the perl script from C++ and send the output back to C++ without any issues. Problems arise when I uncomment the third line, use IO::Socket; I'm getting error message saying that
Can't load module IO, dynamic loading not available in this perl. (You may need to build a new perl executable which either supports dynamic loading or has the IO module statically linked into it.)
This is because IO itself is a C library. I've added the xs-glue as mentioned here. It didn't solve my problem as the added glue is looking for boot_IO symbol (which is defined in IO.so file). I cannot link my application with IO.so as it is a file, which perl opens at runtime, using dlopen. (Also, my application should work on windows, and windows provides only .dll file and not .lib file). What is the way out ?
I'm thinking of writing a wrapper function boot_IO which runs the actual boot_IO function from IO.so at runtime using dlopen. Is this the only option ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Embed Perl in C++ (C in perl in C)
by chrestomanci (Priest) on Jul 26, 2011 at 08:51 UTC | |
|
Re: Embed Perl in C++ (C in perl in C)
by davido (Cardinal) on Jul 26, 2011 at 08:27 UTC | |
|
Re: Embed Perl in C++ (C in perl in C)
by ikegami (Patriarch) on Jul 26, 2011 at 08:48 UTC | |
|
Re: Embed Perl in C++ (C in perl in C)
by Anonymous Monk on Jul 26, 2011 at 08:31 UTC |