[comp.sys.mac.programmer] Link Error: ThePort undefined

gixb@k9.cs.orst.edu (Brian Gerard Gix) (04/11/89)

Hi there,...   my problem appears to be fairlt simple, but at the moment is
a bit out of my grasp...
	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.
	Any suggestions?  Thanks...

	Brian     (gixb@k9.cs.orst.edu)

siegel@endor.harvard.edu (Rich Siegel) (04/11/89)

In article <9896@orstcs.CS.ORST.EDU> gixb@k9.CS.ORST.EDU (Brian Gerard Gix) writes:
>Hi there,...   my problem appears to be fairlt simple, but at the moment is
>a bit out of my grasp...
>	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

	For non-applications, you need to use DRVRRuntime.Lib.

		--Rich

~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

 "She told me to make myself comfortable, so I pulled down my pants
 and sat in the pudding." -Emo Phillips
~~~~~~~~~~~~~~~

jackiw@cs.swarthmore.edu (Nick Jackiw) (04/12/89)

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

siegel@endor.harvard.edu (Rich Siegel) (04/12/89)

In article <2666@carthage.cs.swarthmore.edu> jackiw@carthage.UUCP (Nick Jackiw) writes:
>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

	I'd KILL for a copy of TP 3.0!

	I wonder if that's a free update. :-)




~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

 "She told me to make myself comfortable, so I pulled down my pants
 and sat in the pudding." -Emo Phillips
~~~~~~~~~~~~~~~