Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!cbmvax!vu-vlsi!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: Link Error: ThePort undefined Message-ID: <2666@carthage.cs.swarthmore.edu> Date: 11 Apr 89 18:42:21 GMT References: <7268@blia.BLI.COM> <9896@orstcs.CS.ORST.EDU> Reply-To: jackiw@carthage.UUCP (Nick Jackiw) Distribution: usa Organization: Visual Geometry Project, Swarthmore College, PA Lines: 29 In article <9896@orstcs.CS.ORST.EDU> gixb@k9.CS.ORST.EDU (Brian Gerard Gix) writes: > I'm trying to build a stand alone Code resource using Think Pascal 3.0 > and everything is working out ok except for ThePort being undefined in the > RunTime.lib file. I originally had it built as an application and it worked > fine, no link errors or anything. I have only local variables in the code, > one entry point, and never use ThePort explicitly although I do make a few > calls to quickdraw procedures. Wow! THINK Pascal 3.0! I can't help you out. But in 2.0, the answer to your problem would be... Use DRVRRuntime.lib instead of RunTime.lib. This is because RunTime lib references its variables off register A5 and expects ThePort (a QD var) to be down there. In English, this means that some conditions which are true for applications AREN'T true for Code Resources, and the different libraries (RunTime vs. DRVRRunTime) reflect these differences. Now, if you NEED thePort to pass to something explicitly (like CopyBits), there are a number of ways to get it. If the window you plan to draw to is topmost and has been SetPort'd before you get called, you could just use FrontWindow to get a windowPtr=grafPtr, for instance. Hope this helps. -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA