Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!netcom!mcmahan From: mcmahan@netcom.UUCP (Dave Mc Mahan) Newsgroups: comp.sys.amiga.tech Subject: Re: Does Everybody leave dos.library open? Message-ID: <15062@netcom.UUCP> Date: 18 Oct 90 02:38:32 GMT References: <14766@netcom.UUCP> <1278@kriski.toppoint.de> Organization: Dave McMahan @ NetCom Services Lines: 29 In a previous article, kris@kriski.toppoint.de (Kristian Koehntopp) writes: >In article <14721@netcom.UUCP> mcmahan@netcom.UUCP (Dave Mc Mahan) writes: >> I was just cruising through some software today, and noticed that many >> programs leave the dos.library open after exiting. It seems to be >> a majority in the (limited) sample of stuff I tested, mostly PD. > >This is due to an error in the startup-code of Manx Aztec C Compiler, which >was present to at least version 3.6. This startup-code opened the >dos.library but did not close it automatically. I always added an appropiate >"CloseLibrary" to my programs. Technically, I don't think this is legal to do from within your program. What happens if you close the library, but the exit code produced by the compiler (located in manx:crt_src/_main.c for the Manx compiler I have) tries to do something with the library? Things that come to mind are the CloseLib() calls that Manx makes to close libraries it has opened. Technically, if you close the library, the program should never use it again because it may have been flushed from memory. To do this correctly, you would have to modify the example _main.c source file provided by Manx and then make that your standard startup call. In real life, just using the dos.library even though your program as closed it earlier is probably no big deal since several other programs are using it at the same time so it is always open, but it is technically not a good idea. >Kristian -dave