B
Bastian Friedrich
Hi,
I am currently working on a project that uses the "perlembed" methods to run
perl functions from within a C program. The structure is similar to
Apache's "mod_perl":
Program A loads my library B with the "dlopen" POSIX system call. Library B
is linked against Perl (-lperl /path/to/Dynaloader.a). Library B
initializes a Perl interpreter C that parses a script D. In this script,
there are "use" statements for modules that in turn need binary extensions.
Perl itself uses the "dlopen" call itself to load these extensions.
dlopen takes two parameters: file path, and flags.
* When the first dlopen call (A -> B) is done _without_ "RTLD_GLOBAL"
flag, a segfault occurs during the parsing of the script.
* When linking program A with perl, everything is fine
* When using the RTLD_GLOBAL flag, everything is fine
* When script D does not load binary extensions, everything is fine.
* When statically linking library B to program A (instead of dlopening it),
everything is fine.
Obviously, there is some problem with the dlopen calls (
If you are interested in the topic, you can download a sample program from
http://www.iump.de/perl_via_dlopen.tar.gz
So my questions are:
* Is this behaviour "normal"? Is RTLD_GLOBAL in fact absolutely necessary in
that place?
* Did I really hit a perl bug??
* Do you know about any workarounds?
Thanks a lot, Regards,
Bastian
I am currently working on a project that uses the "perlembed" methods to run
perl functions from within a C program. The structure is similar to
Apache's "mod_perl":
Program A loads my library B with the "dlopen" POSIX system call. Library B
is linked against Perl (-lperl /path/to/Dynaloader.a). Library B
initializes a Perl interpreter C that parses a script D. In this script,
there are "use" statements for modules that in turn need binary extensions.
Perl itself uses the "dlopen" call itself to load these extensions.
dlopen takes two parameters: file path, and flags.
* When the first dlopen call (A -> B) is done _without_ "RTLD_GLOBAL"
flag, a segfault occurs during the parsing of the script.
* When linking program A with perl, everything is fine
* When using the RTLD_GLOBAL flag, everything is fine
* When script D does not load binary extensions, everything is fine.
* When statically linking library B to program A (instead of dlopening it),
everything is fine.
Obviously, there is some problem with the dlopen calls (
If you are interested in the topic, you can download a sample program from
http://www.iump.de/perl_via_dlopen.tar.gz
So my questions are:
* Is this behaviour "normal"? Is RTLD_GLOBAL in fact absolutely necessary in
that place?
* Did I really hit a perl bug??
* Do you know about any workarounds?
Thanks a lot, Regards,
Bastian