🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #2170

NXBundles and external libraries

#2170
From: Paul F. Kunz
Date: Thu, 21 Jan 1993 05:49
47 lines
2657 bytes
   I would appreciate advice on how to best handle the following 
situation...

   I have a large body of code with nibs which I've encapsulated in to
a NXBundle.  The code makes calls to an external library package.  The
purpose of the bundle is so that a number of other applications can
load this bundle rather than compiling and linking their own copies of
the source code.  These other applications also link against the same
external library, but far fewer members of the library.

   The problem is how do I get all the external references from the 
library resolved at run time and yet get the application to build.
That is, if the application links against the external library, it
only pulls out a few members and when the bundle loads, there will
be many missing external symbols.   When I build the bundle I could
include the library, but then I'll get duplicate segment problems.

   The two ideas I have to solve this problem; which might also help
clarify what I'm talking about, are the following...

- Method 1:
	o force the loading of the entire library into the bundle.
	o don't link the Application against the library.
	o tell the linker with the -U option to ignore the few undefined
	  symbols when building the application.
	o Make sure that the application loads the bundle before attempting
	  to use any functions in the library.

The bundle needs the entire library anyway, so the first item is not 
a problem.   Asking each application builder to list their references
to the library via the -U mechanism is rather unpleasant.

- Method 2:
	o don't load the library with the bundle.
	o force the loading of the entire library in the application
	  with the -all_load option of ld

'-all_load' option seems to work on all libraries, so I'll have to take
extra steps so it applies only to this one library.

   I think method 2 makes more sense, but haven't tried it yet.   But
I'm wondering if I'm missing an even better mechanism to accomplish
this.   Any suggestions?
--
Paul F. Kunz	pfkeb@slac.stanford.edu (NeXT mail ok)
Stanford Linear Accelerator Center, Stanford University
Voice: (415) 926-2884   (NeXT) Fax: (415) 926-3587
Technical Details
Message-ID: <PFKEB.93Jan20214908@kaon.SLAC.Stanford.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!kaon.SLAC.Stanford.EDU!pfkeb

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!kaon.SLAC.Stanford.EDU!pfkeb
From: pfkeb@kaon.SLAC.Stanford.EDU (Paul F. Kunz)
Subject: NXBundles and external libraries
Message-ID: <PFKEB.93Jan20214908@kaon.SLAC.Stanford.EDU>
Lines: 47
Sender: news@unixhub.SLAC.Stanford.EDU
Organization: Stanford Linear Accelerator Center
Date: Thu, 21 Jan 1993 05:49:11 GMT