Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!aplcomm!uunet!mcsun!ukc!tcdcs!maths.tcd.ie!ecarroll From: ecarroll@maths.tcd.ie (Eddy Carroll) Newsgroups: comp.sys.amiga.programmer Subject: Re: DOSBase Message-ID: <1991Jun17.112444.16294@maths.tcd.ie> Date: 17 Jun 91 11:24:44 GMT References: <1991Jun13.072854.12241@disk.uucp> <1991Jun13.120849.26251@ira.uka.de> <1991Jun13.224411.26546@jato.jpl.nasa.gov> Organization: Dept. of Maths, Trinity College, Dublin, Ireland. Lines: 40 specter@disk.uucp writes: > [ My program works, even when I forget to open dos.library ] > > Byron S_ASCHMIDT@iravcl.ira.uka.de (|S| Angela Schmidt) writes: > The dos.library will be opened while executing the bootblock of a booting > disk. So it is open when your program starts. But you should open it > yourselve, since otherwise you can't tell OpenLibrary which versionnumber > you need. jdickson@jato.Jpl.Nasa.Gov (Jeff Dickson) writes: > I think that the more important point here is that opening the DOS >library prevents it from going away. Everyone seems to be missing the main point here: you need to open dos.library to get a pointer to DOSBase in a legal manner. Without this pointer, you have no way of calling the functions in dos.library. (Of course, as Jeff said, it's important to keep the library open as long as you are using it, or it may disappear from under your feet.) Now, the standard startup code used for C compilers will automatically open dos.library for you and initialise the global DOSBase accordingly. So, as long as you're writing in C, you don't need to explicitly open dos.library yourself. The exception is if you're writing for Kickstart 2.0 and making use of the new DOS functions. In this case, you probably want to open it yourself so that you can check the version number (as noted by Angela above). The fact that the bootblock on a disk opens dos.library is irrelevant. It's bad style to open a library yourself and then forget to close it. You can get away with it for dos.library at the moment, but it conceivably might cause problems in the future. (Of course, it's not quite as bad as closing a library twice by mistake :-) Eddy -- Eddy Carroll ----* Genuine MUD Wizard | "You haven't lived until ADSPnet: cbmuk!cbmuka!quartz!ecarroll | you've died in MUD!" Internet: ecarroll@maths.tcd.ie | -- Richard Bartle