[Dune] Dune on Windows MinGW

Jö Fahlke jorrit at jorrit.de
Wed May 4 13:18:21 CEST 2011


Am Wed,  4. May 2011, 12:34:36 +0200 schrieb Martin Nolte:
> There is a key difference between static variables and methods: space for the
> static variables has to be declared at exactly one point.

Err, no.  Try the attached files, even though im definitely using
MC<double>::e in two different compilation units, this compiles and links
without a problem and even the address of MC<double>::e as determined by the
two compilation units independently is the same.

Just like template functions and inline functions, templated variables
generate weak symbols.  If more than one definition is present at link time,
all but one will be thrown away.

You only get problems if you (fully) specialize MC<double>: in that case
MC<double>::e is no longer a template and you indeed have to make sure that
only one definition exists in all compilation units.

Bye,
Jö.

-- 
A programmer is a device to turn coffee and pizza into bugs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.hh
Type: text/x-c++hdr
Size: 415 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110504/a5915c8a/attachment.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.cc
Type: text/x-c++src
Size: 133 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110504/a5915c8a/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.cc
Type: text/x-c++src
Size: 125 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110504/a5915c8a/attachment-0001.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110504/a5915c8a/attachment.sig>


More information about the Dune mailing list