On Wed, May 23, 2007 at 05:52:55PM -0700, William Ahern wrote:
> On Thu, May 24, 2007 at 10:45:40AM +1000, Sisyphus wrote:
> > 
> > ----- Original Message ----- 
> > From: "Sean McMahon" <[EMAIL PROTECTED]>
> > To: <inline@perl.org>
> > Sent: Thursday, May 24, 2007 8:55 AM
> > Subject: Can Inline link to static libraries
> > 
> > 
> > >One of the reasons I started using Inline was because the xs code someone
> > >gave me couldn't link to static libraries.  Can Inline::C get around this.
> > >Can Inline::Java get around this if I need to use Java?

> I've had issues, on OpenBSD in particular. Since Perl must dynamically load
> the module, what [static] libraries you build with/into your XS module need
> to have been compiled with the -fPIC flag (or whatever the local variant is,
> if one exists; on some systems its the default these days).
> 
> If the static library wasn't built in such a way, then the OP might just be
> out of options.

Not quite. It should be possible to build any extension statically linked to
Perl.  (Not using Inline. I suspect you can't do this with Inline, but you
can with regular XS extensions)

Assuming the Makefile is generated by Makefile.PL, then

    make perl

should generate a new perl executable staticly linked to that extension
(and all existing staticly linked extensions)

But it seems that if you're using a vendor supplied perl that was built with
a shared libperl.so, then this isn't going to work*. You'll need to compile
your own perl. The default in the source tarball is not to have a shared
libperl.so; it just seems that most vendors choose to override this setting.

Nicholas Clark

Reply via email to