[comp.sys.mac.programmer] String constants in a code resource

irwin@oscar.ccm.udel.edu (12/11/88)

  I am trying to write an XFCN in LSC3.0 and ran into a bit of 
a problem.  Are string constants considered globals that are not
allowed?  I tried setting a (pointer to char) to a string constant.
I then wanted to copy this string to the returnValue.  The copying
works in a simple application but if I try it in the XFCN, the
string pointer points to a NULL and nothing gets copied.  If I use
many 4 byte constants ('abcd') to fill a string, it works.
  Maybe I am just completely missing something because I should be
out having fun now but I am sitting here at my desk _working_!

  Well, thanks for any help you can give.

					Richard Irwin
					irwin@oscar.ccm.udel.edu
					Center for Composite Materials
					Univeristy of DelaWhere?

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

In article <5919@louie.udel.EDU> irwin@oscar.ccm.udel.edu writes:
>  I am trying to write an XFCN in LSC3.0 and ran into a bit of 
>a problem.  Are string constants considered globals that are not

	In version 3.0, string constants (and floating-point constants) are
stored in the global data area. This means that in a code resource, you'll need
to preface your code with a RememberA0() followed by a SetupA4(), to ensure
that your globals pointer is set up correctly.

	This same "feature" also means that you can't use string or floating-
point constants in a library that's to be imported into Lightspeed Pascal
2.0...

		--Rich


Rich Siegel
Staff Software Developer
THINK Technologies Division, Symantec Corp.
Internet: siegel@endor.harvard.edu
UUCP: ..harvard!endor!siegel
Phone: (617) 275-4800 x305

Any opinions stated in this article do not necessarily reflect the views
or policies of Symantec Corporation or its employees.