Am Mittwoch, 8. April 2015 um 22:06:54, schrieb Georg Baum <b...@lyx.org>
> commit d4718b18b6b29a25aaa869c5f38b49eff20eafef
> Author: Georg Baum <b...@lyx.org>
> Date:   Wed Apr 8 22:04:13 2015 +0200
> 
>     Fix tex2lyx linker error on windows
>     
>     The FontMetrics dummy class was in the wrong namespace. Linking on linux
>     did work because the GNU linker is more clever than the MSVC linker for 
> this
>     particular example and throws out more unused code, so that 
> theFontMetrics was
>     not referenced at all.
> 
> diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
> index 9e9c310..7807a7d 100644
> --- a/src/tex2lyx/dummy_impl.cpp
> +++ b/src/tex2lyx/dummy_impl.cpp
> @@ -125,15 +125,16 @@ string alignmentToCSS(LyXAlignment)
>  // Dummy FontMetrics (needed by Length)
>  //
>  
> -
> +namespace frontend {
>  class FontMetrics {
>       int em() const { return 0; };
>  };
> +}
>  
>  class FontInfo;
>  
> -FontMetrics const & theFontMetrics(FontInfo const &) {
> -     static FontMetrics dummy;
> +frontend::FontMetrics const & theFontMetrics(FontInfo const &) {
> +     static frontend::FontMetrics dummy;
>       return dummy;
>  }
>  

Ouch!

Looks, like in the other source, src/tests/dummy_functions.cpp, the same 
mistake happens.
As that is the origin of the corrected code. And we never have seen it, because
Uwe does not compile the test programs. (The script which I suppose he uses,
is creating only targets 'lyx' and 'tex2lyx'. The problem arises, when starting 
to create the installation.
In that case the target he uses is 'ALL_BUILD')

> Let us analyze it:
> 1) The linker complains about an unresolved symbol.
> 2) The name of the symbol is lyx::frontend::FontMetrics.
> 3) Cannot be! This symbol is in dummy_funcs.cpp.
> 4) Maybe it is the order of the objects on the linker command line as Kornel
> suggested? No, this is not the case (you could either try it out, or
> remember that the linker commandline order usually not matter for object
> files, only for libraries in certain cases).
> 5) OK, there must still be an error in the reasoning above. Assuming that
> the linker is correct it can only be item 3) => read dummy_funcs.cpp again
> very carefully
> 6) Bingo! dummy_funcs.cpp contains a class lyx::FontMetrics, not
> lyx::frontend::FontMetrics

To your wonderful analysis:
3a.) This file (src/tests/dummy_functions.cpp) has the same code and it works 
there.

The other reason is 'Das anthropische Prinzip' 
http://www.n24.de/n24/Kolumnen/Prof-Ulrich-Walter-Wissenschaft/d/6442044/das-anthropische-prinzip.html
In short: 'we see what we believe to see'

        Kornel

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to