[comp.sys.mac.programmer] C globals

cs290ac@ux1.cso.uiuc.edu (06/18/90)

I'm writing a code resource using think C 3.0.  I want to be able to
pass a string constant to a function like this:
call_function ("this is a string");
I disassembled and looked closely.  When I do the above, think C stores
the string in global area and accesses it via the A4 register.  So, unless
I use the macros provided by Think to restore the A4 after each call, the
above doesn't work since we all know globals are a no-no in code resources.
I don't really want to use the macros since the string stuff isn't really
necessary (used for debugging).
My question is whether there is a simple way to have C tag the string
after the subroutine that uses it, and have the string be accessed locally
via the A6?

--Ron Smith

siegel@endor.harvard.edu (Rich Siegel) (06/18/90)

In article <18300014@ux1.cso.uiuc.edu> cs290ac@ux1.cso.uiuc.edu writes:
>My question is whether there is a simple way to have C tag the string
>after the subroutine that uses it, and have the string be accessed locally
>via the A6?

	Version 4.0 stores strings and globals in a PC-relative location
for single-segment code resources, so RememberA0/SetupA4/RestoreA4 are
no longer necessary.

R.



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

"It's not the years, honey, it's the mileage."

~~~~~~~~~~~~~~~