Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!mkent From: mkent@dewey.soe.berkeley.edu (Marty Kent) Newsgroups: comp.sys.mac.programmer Subject: Globals in Device Drivers, LSC 3.0 ?? Message-ID: <28152@ucbvax.BERKELEY.EDU> Date: 23 Feb 89 21:12:59 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: mkent@dewey.soe.berkeley.edu (Marty Kent) Organization: School of Education, UC-Berkeley Lines: 28 I'm building a device driver to implement journalling (as hinted at in IM-I), using Think C 3.0. Things seem to be okay except my globals aren't working. The Think manual (pg 76-77) says the driver glue is supposed to pre-allocate space for the globals in the device control block's dCtlStorage field, and that the device's Open routine should check to make sure that's been done properly (i.e. the field should be a handle rather than 0). When I read this I assumed the implicit possible problem was the usual one with dynamic storage allocation, i.e. maybe there wasn't enough space. It turns out my Open routine *is* finding a 0 in the dCtlStorage field. Since I'm running with 8Meg of memory on a Mac II, I know there's enough memory. (In fact, when I added an explicit call to NewHandle in my Open routine, it worked fine.) Does anyone have any ideas as to what I might be doing that's causing the driver glue to fail to allocate the globals? By the way, if I let the driver open with a null dCtlStorage, the individual routines work fine, but they can't communicate with each other. This is all running under MultiFinder, System 4.3, Finder 6.0. Any clues will be much appreciated! Marty Kent Sixth Sense Research and Development 415/642 0288 415/548 9129 MKent@dewey.soe.berkeley.edu {uwvax, decvax, inhp4}!ucbvax!mkent%dewey.soe.berkeley.edu Kent's heuristic: Look for it first where you'd most like to find it.