I'm not sure if I understood your doubt but just think a little bit, you
can put all the variables declaration inside a header file, be those
variables extern or not, and your source.c file (or source.c files) could
just "include" that header file. Beside of this, you could have other
modules where those variables are "really" declared. A extern variable
informs to the compiler that this variable is not is that module, just
that. The link must do the hard work.
I hope this information worths for you.
Good luck.
Ronaldo Z. Afonso
Projetista de Software
Cyclades Brasil
[EMAIL PROTECTED]
Phone: 55 11 5033-3361
Fax: 55 11 5033-3388
www.cyclades.com.br
"Robert P. J.
Day"
<[EMAIL PROTECTED] To
g.com> C programming list
Sent by: <[EMAIL PROTECTED]
linux-c-programmi g>
[EMAIL PROTECTED] cc
nel.org
Subject
weird structure definition in
09/06/2005 04:13 header file
PM
i'm looking at some legacy code and, in a header file, i find the
following (paraphrased for brevity):
typedef struct {
... stuff ...
} Widgets ;
extern Widgets Widget ;
huh? i can see why a header file would want to define a structure
but i'm confused why the *header* file would then refer to an external
object of that type. that's a new one on me -- typically, i'd expect
a *source* file to define such a thing and other *source* files to
contain the "extern" declaration.
is this some subtle programming cleverness of which i am unaware?
thanks.
rday
-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming"
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html