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):

mod.lib(block)
 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 / 
getFloat)

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


Code listing:


./mod/

    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
pause


begin 666 dtest.zip

M`/6T=C707-D5 0```, ````/````9'1E<W0O8G5I;&0N8F%T18VQ#L( %$5W

MS7UC.L*MAG<)7E/?\;R38J] 3:!64 ^$$.GDXPNI4EIBLDMQ-K?"^#A]D:3P
MSNP6=\C(2C0?^ LUUCE3N^&#T

MY>+E*LO/3%'(3<S,T]#DY
M`%:T=C4````````````````*````9'1E<W0O;6]D+U!+`P04````" #WM'8U
M4;T"^54```!O````$0```&1T97-T+VUO9"]B;&]C:RYDR\U/*<U)50!2>DDY
M^<G9UKQ<O%R9N07Y125 P8*B_(+4HI+,U&)DF>*2%+WBDJ+,O'2P:').8G&Q
M A-(/R]7-2\79VYF16:>0 !<KZ*&)E!A+2\7`%!+`P04````" ! M'8U)M?5
MTUH```!C````#P```&1T97-T+VUO9"]L;V<N9,O-3RG-254`4GHY^>G6O%R\
M7)FY!?E%)0K%)2EZ0)R9#Q8LR\],44A,2M902,Y(+(J.52A6T.3EJN;EXBPO
MRBQ)3<O)TU!0\LQ+R[=24"U6T %)`_75 K0"`%!+`P04````" !*M'8U7]+Q
M%/H```#L
M\!V&A8(NBP^PRUZVU[T768*.;B FDAGWA])W[Z1)K1<2,7+.Y)LS<73=;!!D
MJR;O)O2LD<YY%E9K%!%\+O+[L\6)M;-P N4[S[[R;,<W306T-^7K!D8D4 -"
M*48P=S0+H?C7SR)^YYD\83&.DU&,JTY%&;%WISL Y _C%"]\JT8\0A\TN"LS
MKSI=?U6J0TD#EVBG=O*.9X8MX,*(18=$OD136TAH 84BW1>I0A/8V1 H RP7

MCSQ["X>M$>LX6+,*+>X/4$L!`A0`" ``````1;5V-0````````````````8`
M```````````0`````````&1T97-T+U!+`0(4`!0````(`/6T=C707-D5 0``
M`, ````/````````````( ```"0```!D=&5S="]B=6EL9"YB87102P$"% `4

M;6%I;BYD4$L!`A0`" ``````5K1V-0````````````````H````````````0
M````, $``&1T97-T+VUO9"]02P$"% `4````" #WM'8U4;T"^54```!O````
M$0```````````" ```!:`0``9'1E<W0O;6]D+V)L;V-K+F102P$"% `4````
M" ! M'8U)M?5TUH```!C````#P
M+VQO9RYD4$L!`A0`% ```` `2K1V-5_2\13Z````[ $``!8```````````` 
M````90(``&1T97-T+VUO9"]P<F]P97)T:65S+F102P4&``````<`!P"C`0``
&DP,`````
`
end
Nov 22 2006