Mail Archives: djgpp/1998/01/04/20:49:54
>I'm having a problem with the extern keyword. I'm doing a multi-file
>project in RHIDE, and I'm declaring something I want all the functions
>to be able to acess above my main and then in the other files declairing
>it the same way with the extern keyword before it. The problem is that
>the variables are all equal to 0 when I use extern, but they have values
>in them in main. Can anyone tell me what I'm doing wrong. Here's an
>example of what I'm doing:
>
>extern Sprite sprite; //sprite being a tydefined
>structure
>
>
This might not be the best advice.... but pass the sprite (or a sprite pointer)
as a parameter....
as far as other externals... here's what I did...
in the modules... let's say they're called modey.h & modey.c
declare variables as extern in the .H (again - no assignments there)
in the .C ... declare the variables as you normally would...
(so you have 2 declarations)
Now... let's say the project uses.... implement.c (the main procedure is in
it)... and the file modey.c....
put #include "modey.h" in BOTH .C sources....
actually - you can do that with the sprites too...
I hope this helps....
Jim the loiterer (wannabe PC game/graphics developer)
http://members.aol.com/qball1723/index.htm
[please don't hate me because I pay too much for poor internet service!!]
- Raw text -