home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / hp / 9814 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.7 KB  |  46 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!centerline!franl
  3. From: franl@centerline.com (Fran Litterio)
  4. Subject: Re: Linker selection of symbols from shared-libs
  5. In-Reply-To: franl@centerline.com's message of Fri, 28 Aug 1992 18:25:12 GMT
  6. Message-ID: <FRANL.92Aug28132919@draco.centerline.com>
  7. Sender: news@centerline.com
  8. Nntp-Posting-Host: draco
  9. Organization: CenterLine Software, Inc.
  10. References: <3270@tivoli.UUCP> <FRANL.92Aug28132512@draco.centerline.com>
  11. Date: Fri, 28 Aug 1992 18:29:19 GMT
  12. Lines: 32
  13.  
  14. franl@centerline.com (Fran Litterio) writes:
  15.  
  16. > stuart@TIVOLI.COM (Stuart Jarriel) writes:
  17. > > Lets say I have a shared lib, libmine.sl, and there is a function in
  18. > > libmine.sl called write().
  19. > > 
  20. > > So I build my program with:
  21. > > 
  22. > > cc program.c -o program -lmine
  23. > > 
  24. > > will program use the write in libc.sl or in libmine.sl?
  25. > > 
  26. > > (actually, the answer is libc.sl)
  27. > > 
  28. > > Can I force the opposite behavior, so that my library can overwrite the
  29. > > symbols provided in libc.sl?
  30. > You should be able to use the -L option to make ld(1) look in the
  31. > directory containing libmine.sl before it looks in /lib and /usr/lib.
  32.  
  33. Sorry.  Ignore my previous posting.  The -L option won't help you.
  34. The cc(1) driver should invoke ld(1) in such a way that libc.sl (or
  35. libc.a) is scanned last when looking for a defining instance of a
  36. symbol).  You should not have to do anything to get the behavior you
  37. want.  Try invoking ld(1) directly, or try giving the "-Wl,-a,archive"
  38. option to cc(1) which will force ld(1) to use archive libraries
  39. instead.
  40. --
  41. franl@centerline.com   || Fran Litterio                               
  42. uunet!centerline!franl || CenterLine Software R&D                     
  43. 617-498-3255           || 10 Fawcett St, Cambridge, MA, USA 02138-1110
  44.