Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcnc!gatech!ukma!psuvm.bitnet!cunyvm!STEVEG!MAINE.Bitnet!NAVPGS!4526P
From: 4526P@NAVPGS.BITNET (LT Scott A. Norton, USN)
Newsgroups: comp.sys.amiga
Subject: What opens dos.library, and why doesn't it close?
Message-ID: <0274526P@NAVPGS>
Date: Fri, 10-Jul-87 13:25:00 EDT
Article-I.D.: NAVPGS.0274526P
Posted: Fri Jul 10 13:25:00 1987
Date-Received: Sun, 12-Jul-87 17:11:00 EDT
Organization: Naval Postgraduate School
Lines: 51

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?
     
I looked at my programs.  None of them open or close dos.library.
They rely on the AmigaDOS loader's automatic opening of
dos.library, and the AmigaDOS manual says that the loader will
also close the dos.library when the program terminates.  (
Incidentally, the BCPL programs don't leave dos.library open.
I'm not sure if they open it at all.  )
     
Here are my questions:
     
1.  What really opens the dos.library?  The loader, or is there
an some OpenLibrary() incorporated in the programs' startup code?
( The AmigaDOS manual says something about the linker fiddling
with the _LVO symbols, but it is not very clear.  The manual also
assumes use of the Lattice linker, and I've got Manx.  )
     
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?
     
4.  Does it really matter?  Since the dos.library is almost as
fundimental as the exec.library, I don't expect it will drop to
an OpenCount of 0 and be unloaded.  I assume it is a resident
library and part of the Kickstart memory.  The only drawback I
can see of not closing this library is that it is not possible to
move or replace a library as long as it is open.  So, I can't
replace the dos.library with one of my own without altering the
kickstart disk or some non-dos code that executes right at
startup.
     
LT Scott A. Norton, USN
Naval Postgraduate School
Monterey, CA 93943-5018
4526P@NavPGS.BITNET
---
     


  "George took the mouse and threw it across the pool to
the other side, among the brush.  'What do you want of a
dead mouse anyways?'
   'I could pet it with my thumb while we walked along,'
said Lenny."
                            -John Steinbeck, "Of Mice and Men"