Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!helios.ee.lbl.gov!ux1.lbl.gov!osborn From: osborn@ux1.lbl.gov (James R Osborn) Newsgroups: comp.sys.mac.programmer Subject: SAMPLE cdev in C Summary: How in the "C" do you do it? Keywords: cdev, CDEV, LSC Message-ID: <1845@helios.ee.lbl.gov> Date: 5 Feb 89 22:44:29 GMT Sender: usenet@helios.ee.lbl.gov Reply-To: osborn@ux1.lbl.gov (James R Osborn) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 44 Greetings Wise Ones, I have been attempting to do the SAMPLE cdev given in IM-V p.323 using LSC 3.01p3. I was simply trying to do a direct translation from the example in Pascal to C. When I try to run the damn thing (in the control panel), the ICN# shows up properly and I can select it. Sometime soon after it has drawn in the gray background and the specified nrct, it crashes (causing my MacsBug to take over) with an address error at 0x3. The thing crashes before the dialog items are drawn, but I don't know if the control panel calls my cdev function first or not. My resources appear to be in ship shape. My first thought was that my function is not using the proper calling conventions or something along these lines. I can see no problems however, and here is how I declared the function: pascal long main (message, Item, numItems, CPanelID, theEvent, cdevValue, CPDialog) int message, Item, numItems, CPanelID; EventRecord *theEvent; long cdevValue; DialogPtr CPDialog; I don't know how to prod around with MacsBug very effectively, so I don't really know where the thing is bombing. Aside from any suggestions on this problem, can anyone offer any tips on debugging code resources with LSC? I could not find any information about this in the manuals. The only thing I could think of (in this particular case) would be to write an application that would call this thing and mimic the control panel's inter- action with it. BTW, if people who don't know how to write cdev's are interested in this C example, I shall post it (when it works) in (I think): comp.sys.mac.sources THANKS in advance for any help, James R. Osborn osborn@ux1.lbl.gov Lawrence Berkeley Laboratory