Sandi,
The reason they're defined as extern in merc.h is so that other
functions can use these variables. If you put the declarations (not the
extern) into merc.h, then the gsns would be declared in every file that
includes merc.h - kinda like declaring "int foo;" in *all* your source
files. They will compile perfectly individually, but when linked together
you'll get lots of errors about repeated declarations of, you guessed it,
"int foo." Anything that is declared more than once - variables, functions,
etc. will cause linking errors. That's why we declare the gsns as extern in
merc.h: everybody will be able to see them and use them, but only db.c will
create the gsn variables themselves. (i.e. it's like having a set of
business cards made with your name, address, phone number, etc... - you can
give them out to anybody in the world that needs to find you or talk to you,
but there should only ever be one of you... that is, unless it's crunch time
and the boss finally perfected that cloning machine in his basement...) :-)
So if you can remove the extern keywords from merc.h and have your code
compile, link, and run without a problem... then I need to get a copy of
your compiler! :-)
Tony
----- Original Message -----
From: "Sandi Fallon" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, February 13, 2007 5:04 PM
Subject: Re: [ROM] gsn definitions
Thanks for the replies, guys.
In response to your responses, I guess you can guess what I did.
And, it seems to be working fine. :)
So, is putting the defines (I'm hoping I get this right - the only
language I know is English.) in db.c an old compiler/slow machine thing,
or is there a real advantage to not just defining those things only in
merc.h? Obviously, it's advantageous to us humans not to have to write new
gsns in two places.
In other words, having commented out the defines in db.c and putting them
in merc.h without the 'extern', am I gonna crash, bloat, or otherwise
regret it?
Thanks,
Sandi
--
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
--
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom