[GiNaC-devel] Patch 6

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Fri Sep 10 11:25:41 CEST 2010


Hi, Jan!

2010/9/10 Jan private <jrheinlaender at gmx.de>:
> Problem: MSVC creates different symbols for "extern const ex _ex0" if it
> is declared at top-level (inside GiNaC namespace) and if it is declared
> inside the body of a function (also inside GiNaC namespace). When
> linking, unresolved external symbols occur.
>
> Solution: Moved the declaration out of the body of the function

I'm afraid your patch is incorrect. The ex.h file is public, and utlis.h is not
(i.e. it's not supposed to be used by programs using GiNaC, and as you
might notice it is not even installed).  In other words, utils.h is supposed
to contain internal functions/variables which should not be exposed to
GiNaC users. Therefore including utils.h from ex.h is just plain wrong.

Also, moving declaration of _ex0 from the ex::ex() ctor scope for all compilers
is not wellcome. _ex0 should not be exposed to user code (in the past that
caused quite a number of problems due to static initialization order fiasco).

> Note: Instead of #include utils.h the same effect would probably be
> achieved by
> namespace GiNaC {
>  extern const ex _ex0;
> }
> at the beginning of the file.

Please do so, and wrap that into _MSC_VER, and leave the code as is for
other compilers.

Thanks for your efforts.

Best regards,
        Alexei



More information about the GiNaC-devel mailing list