Operating System - HP-UX
1834431 Members
2136 Online
110067 Solutions
New Discussion

Linker/Loader finding unresolved procedures

 
Keven Miller
Occasional Contributor

Linker/Loader finding unresolved procedures

On MPE (HP3000), I have program (A) that runs
with runtime library XL.group.act (B),
XL.PUB.act (C).

(A) contains a procedure Z.
(B) has a reference to procedure Z.
(C) contains a procedure Z, similar parameters but different code than that in (A).

On MPE, all (A) references to Z are resolved within itself.
All other references to Z from (B) or (C) are resolved in (C).


However on HPUX, all my references to Z are being resolved from (A).
Such that (B) calls Z from program (A), instead of linking forward to (C).


Anyone aware of this, and ideas of options to get MPE style of linking?
(Besides changing procedure names and all that code editing)

Keven
2 REPLIES 2
Mike Stroyan
Honored Contributor

Re: Linker/Loader finding unresolved procedures

You can change the symbol selection for shared libraries in many ways.

You can hide symbols when linking the main program. The ld -h option says to hide a particular symbol from other shared libraries, (and can hide shared library symbols from the a.out.) You can also use the ld -c option to tell the linker to look in a file for a series of options. That can be helpful if you are hiding a long list of symbols.

The attached example uses -h to hide the a.out's version of "func".

You can also hide functions by changing their declaration to be "static". That requires that those functions are only called from the same source file that they were defined in.

You can also change shared libraries to look first within their own symbols before looking in other shared libraries and the a.out. You can learn more about that looking at the "-B" option in "man ld". There are more binding options in more recent releases than older releases.
Mike Stroyan
Honored Contributor

Re: Linker/Loader finding unresolved procedures

Oh, yeah. Here is the promised attachment.