Re: [cc65] Changing default segment for string literals in cc65?

From: Greg King <greg.king41verizon.net>
Date: 2012-01-30 15:29:56
From: "Payton Byrd"; on Friday, Jan. 27, 2012; at 12:04 PM -0500
>

> On Fri, Jan 27, 2012 at 11:00 AM, Payton Byrd wrote:
> >
> > On Fri, Jan 27, 2012 at 10:32 AM, Joseph Rose wrote:
> >
> >> In cc65, how do I tell the compiler to put specific strings, in a
module,
> >> into a specific memory segment without affecting other strings?
> >
> > Ooh, ooh, I can answer that one!
> >
> > If your string literals are in a C source file, then you use the
> > #pragma rodata-name("segment") command.
> >
> > That will force all constant strings defined in that source file to
compile to
> > the specified segment.

More info:  What Joe wants to do is difficult with anonymous strings
[such as printf("Hello World.\n")].  It is easy to do with named
(defined) strings:

#pragma rodata-name(push, "segment")
const char greet[] = "Hello World.";
  ...
#pragma rodata-name(pop)
  ...
printf("%s\n", greet);

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jan 30 15:38:16 2012

This archive was generated by hypermail 2.1.8 : 2012-01-30 15:38:19 CET