New linker error with xml2 (resolution & question)

ollie ollie at home.net
Tue Sep 3 10:34:10 PDT 2013


On Thu, 29 Aug 2013 13:11:14 +0900, Kenji Hara wrote:

> 
> Did you rebuild xml2 library after updating/rebuilding dmd code?
> Because the dmd commit changes the object file places where some
> instantiated template code are emitted.
> 

After looking into the problem a bit further, I have found that
commit 751353c8217596726ab219b7d3a690e8950e409e, specifically the
removal of !scx->scopesym->isModule() causes the function decorations
to be omitted (pure nothrow @safe) from the test program test\sxml.d
during compilation, but retaining them during compilation of the library
xmlp.lib.

By explicitly adding those decorations to the opEquals function of the
KeyValRec struct in alt\zstring.d, compilation succeeds with the current
git-head.

Time permitting, I would be interested in your insight regarding that
change. My vague recollection was that those decorations were defaults
if not specified.

Thanks,
Ollie


diff from commit 751353c8217596726ab219b7d3a690e8950e409e:

  diff --git a/src/template.c b/src/template.c
  index c0e304c..9bb0411 100644
  --- a/src/template.c
  +++ b/src/template.c
  @@ -5463,8 +5463,7 @@ void TemplateInstance::semantic(Scope *sc, Expressions *fargs)
 
           //if (scx && scx->scopesym) printf("3: scx is %s %s\n", scx->scopesym->kind(), scx->scopesym->toChars());
           if (scx && scx->scopesym && scx->scopesym->members &&
  -            !scx->scopesym->isTemplateMixin() &&
  -            !scx->scopesym->isModule()
  +            !scx->scopesym->isTemplateMixin()
   #if 0 // removed because it bloated compile times
               /* The problem is if A imports B, and B imports A, and both A
                * and B instantiate the same template, does the compilation of A


function signature in sxmltest.obj after
commit 751353c8217596726ab219b7d3a690e8950e409e:

  const(bool function(ref const(alt.zstring.KeyValRec!(string, string).KeyValRec))) 
    alt.zstring.KeyValRec!(string, string).KeyValRec.opEquals


function signature in xmlp.lib before and after commit
and sxmltest.obj after explicitly defining decorations
on opEquals definition:

  const(pure nothrow @safe bool function(ref const(alt.zstring.KeyValRec!(string, string).KeyValRec)))
    alt.zstring.KeyValRec!(string, string).KeyValRec.opEquals


More information about the Digitalmars-d mailing list