Unix Technical Forum

dynamic link of alternate library name

This is a discussion on dynamic link of alternate library name within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> In linking a module on a HP-UX 11.0 system using aCC B3910B A.03.31, I have a dynamic library that ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 04:47 PM
kenneth kahn
 
Posts: n/a
Default dynamic link of alternate library name

In linking a module on a HP-UX 11.0 system using aCC B3910B A.03.31, I have
a dynamic library that I need to add to the link step. This library does
not follow the 'standard' naming convention, LIBxxxx.SL, but rather has
a unique project related name (etiprack). I therefore cannot use the
-l or -s link options as they only work with dynamic libraries with a
standard name.

My problem is when I specify this 'non-standard' library to the linker,
I find that I have to specify the complete path (/path/etiprack) to it
or the linker won't find it. This presents a problem as this library
is now designated as 'static' in the executable attributes:

-bash-2.05b$ chatr et3_api_kak
et3_api_kak:
shared library
shared library dynamic path search:
SHLIB_PATH enabled first
embedded path disabled second Not Defined
shared library list:
dynamic /usr/lib/libCsup.2
static /afs/apd/func/et4/binhp32/etiprack

Notice etiprack is designated as 'static'. I can 'fix' this via

chatr -l /afs/apd/func/et4/binhp32/etiprack et3_api

However, I'd like to 'fix' this up front during the actual linkedit stage.
Is there someway I can link a dynamic library (e.g. etiprack) with a
non-standard name and have it designated as dynamic; i.e. without the
path having to be hard coded?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 04:47 PM
Paul Pluzhnikov
 
Posts: n/a
Default Re: dynamic link of alternate library name

kenkahn@optonline.net (kenneth kahn) writes:

> I find that I have to specify the complete path (/path/etiprack) to it
> or the linker won't find it.


Two solutions:

- create a symlink with "standard" name for it:

cd /afs/apd/func/et4/binhp32
ln -s etiprack libetiprack.sl

then link "normally": -L/afs/apd/func/et4/binhp32 -letipack

[This will also work when/if you have to port this to another OS].

- use -l: library specification:

aCC ... -L/afs/apd/func/et4/binhp32 -l:etipack

[This will not work on any other UNIX I know of].

Cheers,
--
In order to understand recursion you must first understand recursion.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 04:47 PM
jignaasu
 
Posts: n/a
Default Re: dynamic link of alternate library name

> static /afs/apd/func/et4/binhp32/etiprack

on the link line, instead of

"/afs/apd/func/et4/binhp32/etiprack"

you can say

"-L/afs/apd/func/et4/binhp32/ -l:etiprack"

the following
----
cat > 1.c << \!
main () { hi_mom () ; }
!
cat > 2.c << \!
hi_mom () { printf ("hi mom\n"); }
!
cat > 3.c << \!
hi_mom () { printf ("hi dad\n"); }
!
cc -c +z 2.c 3.c
ld -b -o 2.sl 2.o
ld -b -o /tmp/2.sl 3.o
cc -Wl,+s 1.c -L. -l:2.sl
chatr a.out | grep 2.sl
SHLIB_PATH=/tmp ./a.out
----
gives:
----
dynamic ./2.sl
hi dad
----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com