Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uwm.edu!psuvax1!psuvm!cxt105 From: CXT105@psuvm.psu.edu (Christopher Tate) Newsgroups: comp.sys.mac.programmer Subject: INIT/cdev communication question Message-ID: <91083.154101CXT105@psuvm.psu.edu> Date: 24 Mar 91 20:41:01 GMT Organization: Penn State University Lines: 30 Is there anything wrong with this scheme: My INIT opens up a resource of a custom type and ID (chosen to minimize possible conflicts) which contains the data which needs to be shared by the INIT and the cdev. Since the INIT file is first in the resource search chain, the INIT will always open the resource out of its own file. The resource is MoveHHi'd into the top of the system heap and locked down, but *not* DetachResource'd. The INIT gets various information from this resource when needed. Now, the cdev calls GetResource() on that same resource type and ID. Since the cdev is in the same file as the INIT, it gets a handle to the resource image that's already stashed away in the system heap. By altering the proper fields and calling WriteResource(), the cdev can alter these persistent parameters both permanently and dynamically; the INIT will encounter the new values in the memory image the next time it looks. This scheme maintains the distinction between code and data; nothing needs to be stored directly into the cdev or INIT resource images themselves. Anyone see anything wrong with this approach? ------- Christopher Tate | | "Idle lawyers tend to become politicians, cxt105@psuvm.psu.edu | so there is a certain social value {...}!psuvax1!psuvm.bitnet!cxt105 | in keeping them busy." cxt105@psuvm.bitnet |