Mail Archives: djgpp/1998/06/02/23:15:30
You could just create a .CPP file that actually allocates your global data
and then put only a reference to it in thematching .HPP file. Then the
header can always be included, but the CPP file with the actual global data
only gets compiled once. Also it helps to "wrap" the header with a
#ifndef _MY_HEADER_HPP
#define _MY_HEADER_HPP
void MyFunction(void);
extern char MyData;
#endif
Then the CPP file would have the actual definition:
void MyFunction(void)
{
blah blah
}
char MyData
That should work.
Greetings, Alex
Scott Holisky wrote in message <6l1ssn$hpf AT bgtnsc03 DOT worldnet DOT att DOT net>...
>Question: I need to use the same header file in 2 source code files to
>pass around global data. How??? On the other compilers that I use,
>there's a derective that tells the compiler to compile the header only
>once, but allow both source code files to use it and everything in it.
>How can this be done???
> I use RHIDE and have a tired old 386. GCC, LIBC and all are updated to
>the current versions. Any help would be great.
>
> - Thanks, Adam
>
>P.S. If there's another way to use global data on the program level,
>please share. And if this is a hopeless cause, mabye I'll look into
>editing the source code...
- Raw text -