[comp.sys.amiga.tech] Manx precompiled include files

collins@pnet02.cts.com (Steven Collins) (10/31/88)

I am using Manx 3.6 a which supports pre-compiled include files.
For some reason, When I try to precompile a file containing
somthing like:

struct my_structure structure1= {
                                       a bunch of structure intializers
                                };

and then subsequently link it, I get a global called structure1, but
it is uninitialized. The program works fine if I don't precompile
but just include the file, but that means I'm always recompiling 
this big pile of structure inits. 
I realize that I may be going about the whole problem in a dumb way.
What's the smart way to initialize a bunch of structures that contain
20-30 element arrays of LONGS?  I mostly want to avoid making the
compiler chew on them every debugging cycle.
On another topic, 
I am using a snip of code from the PD PerfectSound to read an
a/d converter on the parallel port. this code (ACK! Pffft!) goes
to the hardware registers directly and works fine under 1.2 but
does not work under 1.3. I realize that this is just what MAMA
warned me about, but...but...but...
I don't have a clue how to do it the right way. I'm pretty sure that
the parallel device won't do the job, because I have to use BUSY, POUT
and SEL as outputs to tell the a/d which channel to sample.
Any suggestions or even references on this stuff would be greatly
appriciated.
                             thanks  steve collins
                             !gryphon!pnet02!collins

UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!collins
INET: collins@pnet02.cts.com

dillon@CORY.BERKELEY.EDU (Matt Dillon) (11/01/88)

:I am using Manx 3.6 a which supports pre-compiled include files.
:For some reason, When I try to precompile a file containing
:somthing like:
:
:struct my_structure structure1= {
:                                       a bunch of structure intializers
:                                };
:
:and then subsequently link it, I get a global called structure1, but
:it is uninitialized. The program works fine if I don't precompile
:but just include the file, but that means I'm always recompiling 
:this big pile of structure inits. 
:I realize that I may be going about the whole problem in a dumb way.
:What's the smart way to initialize a bunch of structures that contain
:20-30 element arrays of LONGS?  I mostly want to avoid making the
:compiler chew on them every debugging cycle.
:On another topic, 

	Ow.  I am not sure 'bout the restrictions of the precompiled
include files, but I never put things in them that would actually generate
code or declare space.

	I heartily suggest you never put actual declarations in your
precompiled include files.  

	The solution to your problem:  Simply put the declarations in a 
separate .C file and, assuming you have make, it will only recompile it
if you change it.  If you do not have make then it works the same way ...
you compile that .C file once (into an object), and unless you want to
change the initialization you never compile it again.

					-Matt

hummel@s.cs.uiuc.edu (11/03/88)

Written  9:20 am  Oct 31, 1988 by collins@pnet02.cts.com in comp.sys.amiga.tech:
/* ---------- "Manx precompiled include files" ---------- */
> I am using Manx 3.6 a which supports pre-compiled include files.
> [ ... ] When I try to precompile a file containing somthing like:
>
> struct my_structure structure1= {
>                                        a bunch of structure intializers
>                                 };
> and then subsequently link it, I get a global called structure1, but
> it is uninitialized. 
/* End of text from comp.sys.amiga.tech */

Precompilation works by dumping the symbol table to a file and reading it
back in.  There's no initialization information contained in the symbol
table, hence none gets saved.  Paul and I wound up doing precompilation in
PDC 3.3 this way, and I'd imagine Jim Goodnow did the same when he implemented
Manx.  The bottom line is that you can't have initialized data in a pre-
compiled header.

In the same posting, he asks:
> What's the smart way to initialize a bunch of structures that contain
> 20-30 element arrays of LONGS?  I mostly want to avoid making the
> compiler chew on them every debugging cycle.

Compile them in their own .c file and link with the resulting .o file.
How's that?
				< Lionel
----------

Lionel Hummel					404 W. High St., #6
ldh90267@uiucuxa.cso.uiuc.edu			Urbana, IL  61801
{seismo,pur-ee,convex}!uiucuxa!ldh90267		(H)  (217)344-5303
Dept. of Computer Science			(W)  (217)333-7408
University of Illinois, Urbana-Champaign