> 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]
>
Thanks Tom. Don't know why, but I think that this is what I was
looking for. None of the books I have, which are all beginners
books, go into this aspect. Can you recommend any books
for "intermediate" C? So far, I think I'm doing fairly well. Prior
to this problem, I was able to write and read my structures to disk,
have some ASM x86 specific routines that worked well (like a
clearscreen and a locate). Problem was, I thought a "global"
variable in C was like a global variable in QuickBASIC or xBASE.
Just declare it once and you could use it anywhere.
Oh, the main reason I'm using DJGPP is, as you know, FREE! I'm an
ole DOS fan not to concerned with Windows. I'm planning on moving
entirely to Linux very soon.
I'm off to change my code. I'll let you know how it turns out (and
be back with more questions maybe).
Willy
********************************************************************
Keller Racing
Performance by Design
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.bylleet.com/kz_racing
http://ourworld.compuserve.com/homepages/nostalgia_drag_bike
http://groups.yahoo.com/group/keller_racing
eBAY User ID: kz_racing
SUPPORT YOUR LOCAL DRAG RACER!!
********************************************************************
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
