Shared library problem

Andy Martin andy at ausvm1.iinus1.ibm.com
Thu Apr 11 05:03:15 AEST 1991


I have a number of objects $objs that I want to link into a shared object
$obj for addition into an archive. Thses objects depend upon a number of
libraries -lc, -lX11, -lbsd, -lnck, etc.

When I explictily mention the libriares on the first ld line it works ok:

    % ld -H512 -T512 -o $shobj $objs -bE:$exp -bM:SRE -lc -lXll -lbsd -lnck
    % ar rv $shlib $shobj
    % cc prog.c $shlib
    % setenv LIBPATH :
    % a.out
    %

However when I use the -r flag to ignore the unresolved references for a later
pass I get the error below.

    % ld -H512 -T512 -o $shobj $objs -bE:$exp -bM:SRE -r
    % ar rv $shlib $shobj
    % cc prog.c $shlib -lXll -lbsd -lnck
    % setenv LIBPATH :
    % a.out
    Could not load program a.out 
    Could not load library $shlib[shobj]
    Error was: Exec format error
    %


I have tried numerous variations on the same theme and am not having much luck.
Some better words of wisdom than the manual provides would be helpful regarding
shared libraries and dynamic loading.


Andy Martin
Cooperating Compound Object Toolkit (CCOT)
IBM Personal Systems Programming, 11400 Burnet Road, Austin, TX, 78759.
Office: 808/1K-014, Internal Zip: 3008, Phone: (512) 823-1801.
  INET: amartin at ausvm1.iinus1.ibm.com
  VNET: AMARTIN at AUSVM1
Austin: andy at ruddles.austin.ibm.com



More information about the Comp.unix.aix mailing list