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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |
| |||
| 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. |
| ||||
| > 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 ---- |