Path: gmd.de!dearn!frmop11.cnusc.fr!univ-lyon1.fr!scsing.switch.ch!xlink.net! howland.reston.ans.net!torn!nott!cunews!revcan!micor!latour!atronx!rwm From: r...@atronx.ocunix.on.ca (Russell McOrmond) Reply-To: rmcor...@ccs.carleton.ca Message-ID: Date: Sun, 11 Jul 1993 16:05:47 EST Subject: Re: Shared library bases - a question about libraries Newsgroups: comp.sys.amiga.programmer References: X-Newsreader: TIN [version 1.1 PL6] Lines: 20 Dan E Babcock (d...@shell.portal.com) wrote: : The main reason to return different library bases is : to allow the use of non-reentrant code, code which uses global variables with : no semaphore protection. The main reason is to have local state - Nothing about reentrancy or semaphores. : >Always returning different bases fixes the problem in other words. Any : >reasons _not_ doing that? : : Yes, it wastes memory. Not doing is wastes MORE CPU cycles (To try to find a pointer to a structure that could contain state). It's a trade-off in a number of ways. The programmer of the library could have required that a pointer be passed to EVVERY function call in the library. This would require the user to keep a per-process pointer anyways. Why not have this per-process pointer be the library base, and thus also have the advantages of being able to setpach certain copies/etc/etc.