Path: utzoo!attcan!uunet!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!riley From: riley@batcomputer.tn.cornell.edu (Daniel S. Riley) Newsgroups: comp.sys.amiga.tech Subject: Re: Opening dos.library in C Message-ID: <10109@batcomputer.tn.cornell.edu> Date: 14 Apr 90 14:56:53 GMT References: <6287@star.cs.vu.nl> <205@mtiame.oz> Reply-To: riley@tcgould.tn.cornell.edu (Daniel S. Riley) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 24 In article deven@rpi.edu (Deven T. Corzine) writes: >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. Two (obvious) things you don't want to do when you might be opening a library twice: 1) Don't zero the library base after the inner CloseLibrary()...clearing the pointer will either screw up the outer CloseLibrary() (maybe crashing your Amiga), or you'll end up with the library permanently opened. 2) Don't make any typos. If you set DOSBase = OpenLibrary("ods.library",0);, you effectively zero DOSBase for that process, and your next attempt at any sort of io will crash (including printing the error message telling the user that dos.library couldn't be opened). See, I said they were obvious...guess I'm just feeling obvious today. -Dan Riley (riley@tcgould.tn.cornell.edu, cornell!batcomputer!riley) -Wilson Lab, Cornell University