Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!netserv2!deven From: deven@rpi.edu (Deven T. Corzine) Newsgroups: comp.sys.amiga.tech Subject: Re: Opening dos.library in C Message-ID: Date: 12 Apr 90 08:55:16 GMT References: <6287@star.cs.vu.nl> <205@mtiame.oz> Organization: Rensselaer Polytechnic Institute, Troy, NY Lines: 39 In-Reply-To: jep@mtiame.oz's message of 12 Apr 90 01:07:13 GMT In article <6287@star.cs.vu.nl> peraue@cs.vu.nl (Raue Paul Erik) writes: peraue> Just one little problem... When I try to open the dos.library peraue> it the machine crashes.... peraue> Can anyone send me a working program using the dos.library? On 12 Apr 90 01:07:13 GMT, jep@mtiame.oz (Jesper Peterson) said: Jesper> The dos.library is opened for you by the C startup code, so Jesper> just leap straight into your dos calls. Unless, of course, you're not linking with startup code... Jesper> Apart from it being a bad idea, I don't know if opening a Jesper> library twice will cause the machine to crash. Bad idea?? Better to open the library twice than not at all. Cause a crash? If it does, it's not due to opening it twice. The entire purpose of the runtime libraries is to be shared by various tasks, and all OpenLibrary() (normally) does if the library is already loaded and initialized is to update a usage count in the Library structure. When you CloseLibrary(), this count is decremented, and the library might also be expunged if usecount is zero and a delayed expunge was pending. The library doesn't care who opens it or how many times. Apart from initialization, multiple opens are like multiple layers of Forbid() or Disable() calls -- they nest, but have no other effect. So, opening a library twice will NOT cause a crash, but attempting to use a library without opening it likely WILL. (exec.library being an exception -- if exec.library is toast, so are you, so forget it.) Deven -- Deven T. Corzine Internet: deven@rpi.edu, shadow@pawl.rpi.edu Snail: 2151 12th St. Apt. 4, Troy, NY 12180 Phone: (518) 274-0327 Bitnet: deven@rpitsmts, userfxb6@rpitsmts UUCP: uunet!rpi!deven Simple things should be simple and complex things should be possible.