Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!cs.umn.edu!kksys!edgar!mmug!UUCP From: Jim.Spencer@p510.f22.n282.z1.mn.org (Jim Spencer) Newsgroups: comp.sys.mac.hypercard Subject: HC 2.0, XCMDs, THINK C, globals Message-ID: <672472805.1@mmug.mn.org> Date: 24 Apr 91 02:15:40 GMT Sender: UUCP@p0.f22.n282.z1.mn.org Lines: 19 Brad Pickering writes in a message to All BP> I have some questions about how HC 2 handles XCMDs. I would like BP> to write XCMDs that remember their globals between calls. I tried BP> this with a simple XFCN that just added 1 to a global and returned BP> the value as the result. Each time it was called it came back BP> with the next higher number. But I tried to do this with a more BP> complex XCMD and I've be having lots of problems. Does HyperCard BP> jump to the beginning of the real resource or does it make a BP> copy and jump to the beginning of the copy? If it is using the BP> real resource does it honor the purgable and locked attributes BP> of the resource? I tried marking the resource as locked and it BP> seemed to crash HyperCard. If I use global variables which are BP> pointers to code or data within the XCMD don't want HyperCard BP> to move my resource around makeing the pointers invalid. HyperCard makes a copy of the external and then jumps to the beginning of it. The solution to your problem is to create globals in your script and pass the values to the external (or read them in the external). You should note that externals don't have globals per se. There are mechanisms to in effect create these globals but they are not values off of HyperCard's A5 global space.