Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!uokmax!d.cs.okstate.edu!minich From: minich@d.cs.okstate.edu (Robert Minich) Newsgroups: comp.sys.mac.programmer Subject: Re: Absolute address to strs in Think C Message-ID: <1990Sep10.181615.10742@d.cs.okstate.edu> Date: 10 Sep 90 18:16:15 GMT References: <583@ohs.UUCP> Organization: Oklahoma State University Lines: 34 by stay@ohs.UUCP (Steve Taylor): > The Think C manual says (page 75): | "When the Separate STRS option is on, THINK C uses a 4 byte absolute | address to access the string literals and floating point constants." | | Speculation: | | Since the string literals and fp constants are loaded into the heap | (and locked), and since any reference to things in this heap object | are not absolute until that point, then all of those absolute | references must be set then, after the literals are loaded. This | also means (since code is being changed) that they have to be re-set | every time a code segment with references to the string literals is | unloaded and loaded, which means either Think C is keeping careful | tabs on the segment loader (a patch?) or the segment loader is actually | doing the work. | More speculation: why not just reserve a global for "the_STRS_are_here_Ptr", load in the STRS resource BEFORE calling main() and lock it down, and then just use references off your global! (I think this is what I saw when I was poking around in the asm output of THINK C loking for a bug. I was trying to figure out what all happened in a printf() call and there was extra BS... -- |_ /| | Robert Minich | |\'o.O' | Oklahoma State University| There are no heroes -- |=(___)= | minich@a.cs.okstate.edu | We all wear gray hats. | U | - Ackphtth |