Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!amiga!jimm
From: jimm@amiga.UUCP (Jim Mackraz)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Need help with disapearing libraries!!
Keywords: exec CloseLibrary() low-memory programming-error disk-resident
Message-ID: <2553@amiga.UUCP>
Date: 6 Jul 88 05:55:07 GMT
References: <94Y1F20q831010pYHiE@amdahl.uts.amdahl.com>
Reply-To: jimm@cloyd.UUCP (Jim Mackraz)
Organization: Commodore-Amiga Inc, Los Gatos CA
Lines: 59

In article <94Y1F20q831010pYHiE@amdahl.uts.amdahl.com> kevin@amdahl.uts.amdahl.com (Kevin Clague) writes:
)
)What kind of programming mistakes can I make that would cause libraries
)to be closed without CloseLibrary()'ing them explicitly?  I have a
)program that opens a number of libraries including
)mathieeedoubbas.library and the ffp transcendental library.
)In very low memory situations these two libraries go away without
)me calling CloseLibrary().  I've verified this using Manx's db to
)examine the state of my program after I get a "Task Held" requester.
)Db usually indicates that the last function I've called is SPTieee(),
)and when I list the open libraries using the adl command, both the
)disk resident math libraries I mentioned are gone.
)
)Anyone have any clues as to how this may be happening?  Maybe I wrote
)over some portion of each library.  Does the system checksum the
)libs and verify the checksum (and possibly remove them, without a
)guru)?  I could possibly be setting the lib_OpnCnt (sp?) to zero?
)I can't imagine that I could have selectively done this for both libs
)without trashing one entire lib.
)
)I can't figure out what I've done wrong.  Are there any known system
)bugs in this area?  Again, it occurs in VERY LOW memory situations
)(i.e. less than 40K).  Any clues or help in this area would be
)greatly appreciated.
)                                        -kevin

Here's some suggestions for checking into this problem in a structured
manner.  Old tips, but maybe useful.

- In startup-sequence, loadwb -debug.  This adds the 'invisible' menu
with an entry 'flushlibs.'  After you think you've got the
libraries opened, do flushlibs, and this should try to expunge unopened
libraries (not all libraries expunge).

- Check the libraries open count before and after you open them.
 They DO open, right?

- Printf the library base addresses returned from OpenLibrary().  When
 you crash (or whenever), use wack (romwack will do) and have a look
 at the memory nearby (esp. the library node).  Is the open count still
 reflecting your open (look at exec/libraries.i)?  Is there general garbage?

- It is true, that a library will be expunged if it is not open and the
 the memory is low, so if you don't really hold it open, your symptoms
 could occur.  Note that adl won't display libraries if their
 linkage into the system library list is corrupted.  This is one thing
 to think about in the step above.

- Are you explicitly opening these libraries, or is the startup code of
 the compiler doing it?  Are you trying to 'detach?'

Good luck.  Figure ways to watch the open count before, during, and after
problems.
	jimm
-- 
	Jim Mackraz, I and I Computing	  
	amiga!jimm	BIX:jmackraz
Opinions are my own.  Comments regarding the Amiga operating system, and
all others, are not to be taken as Commodore official policy.