gdc and gcc object linking issues
Kagamin
spam at here.lot
Thu Jun 7 05:27:27 PDT 2012
A class declaration is simply a declaration, it doesn't allocate
storage, so members end up being implicitly extern (or static
inline for methods with bodies) except for instance fields, whose
storage is allocated with the new operator. As static inlining a
field has no sense, it becomes extern. You can declare extern
variables in C too (try it). Extern declarations are included
into each including module, but you can't do it with the
variable's storage itself, so you should *define* the variable in
a module where it will actually keep its value. If you define a
variable in the header, it will be included in each including
module and you'll get several instances of the variable and
symbol collision at link time.
You can think of a class as an interface declaration which
happens to expose some implementation details to you.
More information about the Digitalmars-d-learn
mailing list