www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Mixin problem when compiled as a lib

The error message I'm getting is (this is with DMD v0.174):

 Error 42: Symbol Undefined __init_15TypeInfo_B4AaAa
--- errorlevel 1

I have a package built into a lib (cut down as much as I can), see below for 
source or see attached zip for a version ready to build.

The compile works as a lib in the following cases:

    - log.d is excluded from the compile and lib (its not referenced or used 
in the code in any case)
    - the writefln is commented out (in log.d / abc)
    - the throw PropertiesException is commented out (in properties.d / 

and it also works if all the files are built at once.

Code listing:


    log.d ------------------------------

       module mod.log;

       import std.stdio;

       void abc( char[] s )
        writefln( "Info: %s", s );

    properties.d ------------------------------ (mixin defined here)

        module mod.properties;

        class PropertiesException : Exception
         this( char[] message )
          super( message );

        template Properties()
         void setFloat( char[] name, float value )
          _floats[name] = value;

         float getFloat( char[] name )
          float* value = name in _floats;

          if( value is null )
           throw new PropertiesException( std.string.format( "getFloat: 
property does not exist: %s", name ) );

          return *value;

         float[char[]] _floats;

    block.d ------------------------------ (mixin used here)

        module mod.block;

        import mod.properties;

        import std.string;

        class Block
         mixin Properties!();


    main.d ------------------------------

        import mod.block;

        void main()
         new Block();

    build.bat ------------------------------

set PATH=d:\d\dm\bin;d:\d\dmd\bin;d:\D\dmd\html\d;%PATH%
dmd -c -w -I. mod/log.d mod/properties.d mod/block.d
lib -c mod.lib log.obj properties.obj block.obj
dmd -I. main.d mod.lib
Nov 22 2006