I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-05-22 09:30:57-07 by karthic
Dynamice Loading of Perl
Hi All,
I am trying to embed the perl script in my C program (as per perlembed) . I tried running the examples using perl interpreter and it works fine. When I try embedding one of the examples(colors.pl) in C then I am getting the following error

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.)
at /usr/local/lib/perl5/5.8.0/aix/IO/Handle.pm line 256
Compilation failed in require at /usr/local/lib/perl5/5.8.0/aix/IO/Handle.pm line 256.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.8.0/aix/IO/Handle.pm line 256.
Compilation failed in require at /usr/local/lib/perl5/5.8.0/aix/IO/Seekable.pm line 101.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.8.0/aix/IO/Seekable.pm line 101.
Compilation failed in require at /usr/local/lib/perl5/5.8.0/aix/IO/File.pm line 112.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.8.0/aix/IO/File.pm line 112.
Compilation failed in require at /usr/local/lib/perl5/5.8.0/FileHandle.pm line 9.
Compilation failed in require at Spreadsheet/WriteExcel/OLEwriter.pm line 18.
BEGIN failed--compilation aborted at Spreadsheet/WriteExcel/OLEwriter.pm line 18.
Compilation failed in require at Spreadsheet/WriteExcel/Workbook.pm line 19.
BEGIN failed--compilation aborted at Spreadsheet/WriteExcel/Workbook.pm line 19.
Compilation failed in require at Spreadsheet/WriteExcel.pm line 17.
BEGIN failed--compilation aborted at Spreadsheet/WriteExcel.pm line 17.
Compilation failed in require at colors.pl line 12.
BEGIN failed--compilation aborted at colors.pl line 12.


My C code snippet
-----------------
void fillcolor()
{
char *args[] = { NULL };
dSP;
printf ("Calling perl function\n");
call_argv("fillcolor", G_EVAL, args);
printf ("Calling perl function.. returned\n");
}

perl version - 5.8.0.
Operating system - Aix 4.33
Architecture - x86 32 bit (does it make any difference on 64bit versions ?)


Looking for your suggestions.


Thanks and Regards,
Karthic
Direct Responses: 5201 | Write a response
Posted on 2007-05-22 13:53:47-07 by jmcnamara in response to 5196
Re: Dynamice Loading of Perl

Hi,

I've never tried to embed a Spreadsheet::WriteExcel program in C so I can't say what the problem is. It looks like the interpreter what you are using is having problem loading IO::Handle which is required by Spreadsheet::WriteExcel. You will probably have to ask this question in some forum that knows about embedded Perl.

If you just want to run a Perl program like a self contained executable then you should have a look at PAR.

John.
Direct Responses: 5224 | 5225 | Write a response
Posted on 2007-05-24 13:45:02-07 by karthic in response to 5201
Re: Dynamice Loading of Perl
Looks like a typical problem in embedding perl modules which themselves use C libraries.

Here is the solution
http://perldoc.perl.org/perlembed.html#Using-Perl-modules%2c-which-themselves-use-C-libraries%2c-from-your-C-program


- Karthic
Direct Responses: Write a response
Posted on 2007-05-24 14:01:59-07 by karthic in response to 5201
Re: Dynamice Loading of Perl
Looks like a typical problem in embedding perl modules which themselves use C libraries.

Here is the solution
http://perldoc.perl.org/perlembed.html#Using-Perl-modules%2c-which-themselves-use-C-libraries%2c-from-your-C-program


- Karthic
Direct Responses: 8023 | Write a response
Posted on 2008-06-05 13:43:25-07 by mmathew in response to 5225
Re: Dynamice Loading of Perl
Hello,
I am new to embedding perl in C.
I got a the same error you faced.


# ./testperl index.pl
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.)
Compilation failed in require at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/Handle.pm line 256.
BEGIN failed--compilation aborted at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/Handle.pm line 256.
Compilation failed in require at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/Seekable.pm line 101. BEGIN failed--compilation aborted at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/Seekable.pm line 101.
Compilation failed in require at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/File.pm line 112.
BEGIN failed--compilation aborted at /usr/perl5/5.6.1/lib/sun4-solaris-64int/IO/File.pm line 112.
Compilation failed in require at /opt/siilo/scripts/lib/Config/Record.pm line 27.
BEGIN failed--compilation aborted at /opt/siilo/scripts/lib/Config/Record.pm line 27.
Compilation failed in require at index.pl line 22.
BEGIN failed--compilation aborted at index.pl line 22.
Undefined subroutine &main::storekeyval called at index.pl line 22.
#

I followed the link you have pasted.Somehow the glue didnt work. Would be great if you have any suggestions /pointers.

Thanks in advance,
MM.
Direct Responses: Write a response