Thanks for your reply, Anders!
On Fri, Aug 01, 2008 at 09:37:59AM +0200, Anders Johansson wrote:
Am Freitag 01 August 2008 08:45:06 schrieb Josef Wolf:
The question now becomes, how to (painless) deploy a perl XS library which makes callbacks into perl. That means, the XS library needs access to the my_perl variable, which is declared as
static PerlInterpreter *my_perl;
in the original libperl.so
You'd access it in exactly the same way that you access any other variable. Declare it "external" in your code and simply use it. The linker will take care of the rest
The "static" there has nothing to do with linking. It simply means that the variable isn't created dynamically every time a function is called, it is created once and keeps its value. Static or dynamic linking doesn't enter into it at all
The "static" there has pretty much to do with linking. Because of the "static" keyword the variable is not visible/accessible outside of the compilation unit. Therefore it is only accessible by libperl.so but not accessible by my XSUBs.
By the way, your previous comment about having to compile locally on all machines is wrong. The remark in the man page you quoted is about using the same compiler flags as was used for perl. That doesn't mean it has to be rebuilt every time it is installed
How can I be sure that debian/ubuntu/mandrake/redhat/whatever use the same compiler flags and linker flags as suse? They can even change the flags between releases. So I have to build and maintain a dist package for every release of every distro I want to support. And I have to rebuild every time a distro ships a new release. That would be even more pain than rebuild every time it is installed.