www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16124] New: Object.factory fails for static libs


          Issue ID: 16124
           Summary: Object.factory fails for static libs
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andre s-e-a-p.de

In this example all 3 assertions fails. Class Base and Child are imported via
static libraries. The issue occus on linux and windows with recent
dmd compiler.

file main.d
import base, child;

void main()
    import std.traits: fullyQualifiedName;
    assert( Object.factory(fullyQualifiedName!Child) !is null);
    assert( createObject(fullyQualifiedName!Base) !is null);
    assert( createObject(fullyQualifiedName!Child) !is null);

file base.d
module base;
class Base { }

Object createObject(string name)
  return Object.factory(name);

file child.d
module child;
import base;
class Child: Base { }

The application is compiled via
dmd base -lib
dmd child -lib base.lib
dmd main base.lib child.lib

Jun 05 2016