At 10:55 PM 12/30/2004 -0000, dragtriumph writeth:
>Thanks Tom.  I think maybe I didn't ask the question correctly.  And,
>a lot of those &'s and *'s were after a lot of frustrating attempts
>trying to follow examples in books which weren't really doing what I
>wanted to do.  I was just trying things to see if I could get
>ANYTHING to work!  Let's try staring from the beginning.
>
>These are the files I'm working with:
>
>The ENG, ENV, BM, INT, CMB and EXH files will eventually become a
>library (I hope! ;-)).  Just to prove that my formulas work, I'm
>putting a DOS face on it right now.  Trying to keep things simple.

Well, a "Command Prompt" face would work as well.  I'd personally switch
off of DJGPP - it is an old compiler that can't do direct Windows API
calls.  Possibly not important to you, but getting a newer compiler might
be in your future interest.


>In the ENG file, I want to define a structure containing basic info
>about an engine:
>
>struct engine {
>};

Simple enough to handle.  In a global .h file, put your structure there.
Call it something original like "engine.h".  Then, surround it with
protecting defines:

#ifndef ENGINE_H
#define ENGINE_H

#ifndef GLOBAL_ENGINE
extern
#endif
struct engine {
...bore and all those other variables....
} MyGlobalEngine;

#endif

Now, that gets you an include file.  Next, you want to modify it so that
you have a single instance of the engine structure.  Create a engine.c or
engine.cpp file that has the following:

#define GLOBAL_ENGINE
#include "engine.h"

In all your other .h files that need engine access, include "engine.h" but
DO NOT define GLOBAL_ENGINE.  (Defining GLOBAL_ENGINE again will cause the
linker to generate errors about duplicate names).


Thomas J. Hruska
[EMAIL PROTECTED]

Shining Light Productions
Home of the Nuclear Vision scripting language and ProtoNova web server.
http://www.slproweb.com/



To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to