Xref: utzoo comp.sys.mac.hypercard:315 comp.sys.mac:11940 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!husc6!bloom-beacon!think!ephraim From: ephraim@think.COM (ephraim vishniac) Newsgroups: comp.sys.mac.hypercard,comp.sys.mac Subject: Re: HyperCard XFCNs in MPW C Message-ID: <16007@think.UUCP> Date: 1 Feb 88 16:13:57 GMT References: <226STORKEL@RICE> <3105@watcgl.waterloo.edu> Sender: usenet@think.UUCP Reply-To: ephraim@vidar.think.com.UUCP (ephraim vishniac) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 35 In article <3105@watcgl.waterloo.edu> kdmoen@watcgl.waterloo.edu (Doug Moen) writes: >You can't have global variables *or character string literals* in >an XFCN written in MPW C. >Boy was I pissed off when I figured this out. >I don't know of any reasonable workarounds, either. Sure you do. As you go on to say: >Some kludges for faking string literals: >* You can put them into STR# resources That's the correct method. Or 'STR ' resources, or any custom resource that takes your fancy (preferably with a ResEdit TMPL, to make editing easy). >Both kludges are really pretty awful, but I have no better ideas right >now except to write a preprocessor for stripping out string literals >and replacing them with something that the linker won't choke on. What's awful about putting your strings into string list resources? It's not popular C hacker's style, but it's a hell of a lot easier than recompiling every time you want to change some trivial message. >By the way, you can't put global variables or string literals into >INITs, desk accessories, and related code resources, either. >Does anybody at Apple care enough to fix this? Probably not, since nothing is broken. You've already mentioned the correct method for embedding text in a program: use separate resources. Putting them directly into your code resources will cause would-be translators of your work to curse your name forever. Ephraim Vishniac ephraim@think.com Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142-1214