Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site pyuxvv.UUCP Path: utzoo!watmath!clyde!floyd!whuxle!spuxll!abnjh!u1100a!pyuxn!pyuxww!pyuxvv!brt From: brt@pyuxvv.UUCP (B Reytblat) Newsgroups: net.lang.c Subject: help! (rather long) Message-ID: <195@pyuxvv.UUCP> Date: Tue, 20-Mar-84 10:05:12 EST Article-I.D.: pyuxvv.195 Posted: Tue Mar 20 10:05:12 1984 Date-Received: Wed, 21-Mar-84 03:34:13 EST Organization: AT&T Bell Laboratories, Piscataway N.J. Lines: 59 $$$$$$$$$ <- bribe to the line-eater This is a rather long submission consisting of questions, theories and examples: 1. I'm running C programs in a STAND-ALONE environment. Problem: How does one bind an INITIALIZED variable to a specific address? What I want to do is some thing like this: struct FOO{ ... } name; (struct FOO *)0x80 = &name Needless to say, cc barfs on the 0x80 part. 2. I have attempted to do this by splitting the program in two source files: file1: extern struct FOO name; struct FOO *p_name = &name; file2: static struct FOO name; extern struct FOO *p_name; and then binding the .data section of file1 to the address in question using an allocation tool similar to ld(1). As you can see, p_name must be accessible inside file2. Also, in physical memory, p_name is surrounded by other things, so I can't put name and p_name into the same source file (or else they will go into the same .data section, and end up in contiguous memory locations.) Unfortunately, that didn't work either. It seems (and this is pure speculation based on a few hours of hacking different versions of this) that cc(1) understands (&name) to be a compile-time constant rather than a reference to a variable. I haven't looked at the code to see if this is really true (and if I did, I wouldn't know where to look :-). 3. I'm sure some of you have run into this sort of thing before. Am I completely off base? What have I missed? Are there any "nice" solutions to the original problem of bindidng an initialized variable explicitly? Or is this another one of those things that C cannot do? Thanks for help in advance, B.Reytblat ...!pyuxvv!brt (201)-981-2044 (office) "... I'm a hacker, she's a hacker, he's a hacker, Wouldn't you like to be a hacker too? Be a hacker, Try a little hackin' Be a hacker, Try a little hackin' ..."