PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Christopher Jobson <jobson at sybase dot com>
Subject: static / dynamic linking of sybperl and relationship to other packages
Date: Nov 27 1995 5:47PM

Hi,

I am no great expert on the usage of packages, and hope someone else has bumped
into this problem and has a solution !

My platform is Sun4 / SunOS 4.1.3. I am using perl5.001e and sybperl-2b3.

Basically, I am trying to build a package that will sit alongside sybperl
and also provide an API for accessing DBlib calls (in much the same way that
Sybase::DBlib provides an API for accessing DBlib). I want to be able to
use BOTH my package (which is called 'Sybase::review') AND 'Sybase::DBlib'.
My motivation for doing this is that I need to access a library (libreview.so)
that is also used elsewhere (ie. NOT from perl).

So, from perl I will have calls to routines with names like review_open(),
review_close() etc. I have a 'use Sybase::review;' call in the relevant place.
I have built the necessary review.pm, review.xs etc. files and installed them
in lib/auto/Sybase/review.

I will thus be accessing two sharable libs : libsybdb.so and libreview.so.
Of course, I also have the XS-related sharable objects that REFER to these
two libs. These have the names review.so and DBlib.so. Note also that the
libreview.so library ALSO refers to libsybdb.so.

However, I run into problems with respect to the Dynamic loader, which 
complains
about problems with a message along the lines of :

Can't load '/remote/cpetools/dse/lib/perl5/sun4-sunos/auto/review/review.so' 
for
 module review: ld.so: conflicting usage of dlopen'ed dependents at 
/remote/cpet
ools/dse/lib/perl5/DynaLoader.pm line 128.

It seems that this happens when the loader (via dlopen()) tries to pull in
a second sharable library (in this case ../review/review.so) which refers to
an underlying sharable library (libsybdb.so) which is ALSO referenced via an
earlier dlopen(). Ie. if we do

use Sybase::DBlib
use Sybase::review

then, if both packages use libsybdb, we get the above warning. Interestingly
enough, this problem does NOT happen if I build and link on HP.

Can someone suggest a workaround ?

Also, I have tried linking the various extensions statically into the perl
binary - but got confused here, as I couldn't work out how to stop the dynamic
loader from trying to pick up the sharable object (review.so) even though it
has been statically linked into the perl binary. I think I mist be doing
something wrong here ...

Any clues ? There may be a useful FAQ on the subject ...

- Chris

===============================================================================
=

 Chris Jobson                                    Email:       jobson@sybase.com
 European DSE,
 Sybase Europe BV,
 Sybase Court,                                   Voice:      +44-(0)1628-597263
 Crown Lane,                                     Switchboard:+44-(0)1628-597100
 Maidenhead,                                     Fax:        +44-(0)1628-597112
 Berkshire     SL6 8QZ
 United Kingdom.