Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcnc!ece-csc!ncrcae!ncr-sd!crash!ford
From: ford@crash.CTS.COM (Michael Ditto)
Newsgroups: comp.sys.amiga
Subject: Re: What opens dos.library, and why doesn't it close?
Message-ID: <1410@crash.CTS.COM>
Date: Sun, 19-Jul-87 07:29:38 EDT
Article-I.D.: crash.1410
Posted: Sun Jul 19 07:29:38 1987
Date-Received: Sun, 19-Jul-87 20:41:44 EDT
References: <0274526P@NAVPGS>
Reply-To: ford@crash.CTS.COM (Michael Ditto)
Organization: Crash TS, El Cajon, CA
Lines: 40

In article <0274526P@NAVPGS> 4526P@NAVPGS.BITNET (LT Scott A. Norton, USN) writes:
>Hacking one evening with the AmigaMonitor, I noticed that the
>dos.library had an Open count over 10, where other libraries had
>2 at most Opens.  After calling up a few programs I noticed that
>this open count was never decremented.  What is going on?

There is a bug in the C runtime startoff routines that open dos.library
and never close it.  Most likely, you have a few programs that were compiled
with Aztec C.  The OpenCount will go up by one each time you run such a
program.

>1.  What really opens the dos.library?  The loader, or is there
>an some OpenLibrary() incorporated in the programs' startup code?

The latter.

>2.  If the loader is opening dos.library, I would expect it to
>close it when the program terminates.  As I read the manual, the
>loader _will_ close dos.library.  Is this behavior a loader bug?
>Should I close dos.library myself?  ( Can I even get the value of
>DosBase if the loader opened it for me?  )
>     
>3.  Similarly, if the program's startup code is where dos.library
>is really opened, why doesn't the termination code close it?
>Again, should I close the library myself before I exit?

As far as I know, the problem is only a bug with Aztec.  I have mentioned
it on BIX, I will make sure Manx knows about it.

>4.  Does it really matter?

Probably not, since the only potential problem is that, after running 65,536
such programs, the count will wrap back to zero, at which time the library
could theoretically be "unloaded."  But since rom libraries do not seem ever
to be unloaded, I don't think it will ever be a real problem.
-- 

Michael "Ford" Ditto				-=] Ford [=-
P.O. Box 1721					ford@crash.CTS.COM
Bonita, CA 92002				ford%oz@prep.mit.ai.edu