[comp.sys.mac.programmer] Absolute address to strs in Think C

stay@ohs.UUCP (Steve Taylor) (09/08/90)

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.

If ANY of this is correct, my question is: Where, exactly, do the
absolute references get set?  Thanks.
-- 
Absolute Truth is on vacation, and I'm filling in.
-------------------------------------------------------------------------------
Steven H. Taylor  stay@ohs.uucp  trACE(tm) Development, Alpine School District.

minich@d.cs.okstate.edu (Robert Minich) (09/11/90)

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               |