Re: C- Syntax to allocate Global variables to consecutive memory locations



On Mon, 09 Apr 2007 06:47:40 -0400, Walter Banks
<walter@xxxxxxxxxxxxx> wrote:

"techie.embedded@xxxxxxxxx" wrote:

I need to store at consecutive memory locations,
say starting from 0x8000h . Will appreciate if anyone can list the
syntax / instructions to go about the same.

Byte Craft's compilers have a language extension that allows
defininng the location of variables.

int abc @ 0x123;

for example.

Hi, Walter. Does this look like a storage request to the linker? Or
does it merely create a symbolic linker value?

To put my question in exact context, one of the things I miss having
in C and readily find with assembly coding (usually) is the ability to
define link-time constants. By this, I mean the equivalent in x86 asm
of:

_abc EQU 0x123
PUBLIC _abc

This places a symbolic value in the OBJ file that can be linked into
other files and used as constant values. In c, I might use:

extern int abc;
#define MYCONST (&abc)

and then refer to MYCONST throughout the c source. The result allows
me to modify the constant definitions without requiring recompilation
of the c sources. The link process is all that is required.

If your c compiler creates the object equivalent of a PUBDEF and an
EXTDEF, but no LEDATA, from:

int abc @ 0x123;

That would be interesting.

I hope that sharpens my question.

Jon
.