Hi,
I am using Inline to integrate a C shared library.
Everthing works fine if I set LD_LIBRARY_PATH correctly
in my shell first and then start the perl program. But I would
really like to set this variable inside the perl program
itself so that the program will work whether
LD_LIBRARY_PATH is set in the parent shell environment or not.
I thought that by adding this to the top of the perl script
BEGIN {
$ENV{LD_LIBRARY_PATH}="/path/to/lib";
}
would work. But it does not:
$ ./foo.pl
Had problems bootstrapping Inline module 'foo_pl_067f'
Can't load '/site1/www.clinique.com/tmp/_Inline/lib/auto/foo_pl_067f/foo_pl_067f.so'
for module foo_pl_067f: ld.so.1: /usr/bin/perl: fatal: foo.so: open failed: No such
file or directory at /usr/local/lib/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169.
at /usr/local/lib/perl5/site_perl/5.005/Inline.pm line 432
at ./foo.pl line 60
BEGIN failed--compilation aborted at ./foo.pl line 60.
It looks like the Inline part is not a subprocess of the perl
script so that the setting in perl script does not affect how
Inline part works. Is there a way to change this?
My main question is:
Is there a way to set LD_LIBRARY_PATH in the perl script
when using Inline to interface a C shared library?
Thanks for any info.
Richard