Mixin problem when compiled as a lib

Daniel Giddings daniel.giddings at gmail.com
Wed Nov 22 04:00:57 PST 2006


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
M4$L#! H``````$6U=C4````````````````&````9'1E<W0O4$L#!!0````(
M`/6T=C707-D5 at 0```, ````/````9'1E<W0O8G5I;&0N8F%T18VQ#L(@%$5W
M$O[A+1UY[C8.)@ZZ.71D*7U$42BD8/K[[2,T;N?>W).;;8'G=;A?Z*Q)4]#&
MS7UC.L*MAG<)7E/?\;R38J] 3:!64 ^$$.GDXPNI4EIBLDMQ-K?"^#A]D:3P
MSNP6=\C(2C0?^ LUUCE3N^&#T<U(ARA%&G_92K$!4$L#!!0````(`,VT=C41
M4GZY-@```#<````,````9'1E<W0O;6%I;BYDR\PMR"\J4<C-3]%+RLE/SK;F
MY>+E*LO/3%'(3<S,T]#DY:KFY>+,2RU7< )):V@"%=3R<@$`4$L#! H`````
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 at P8*B_(+4HI+,U&)DF>*2%+WBDJ+,O'2P:').8G&Q
M at 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 at K0"`%!+`P04````" !*M'8U7]+Q
M%/H```#L`0``%@```&1T97-T+VUO9"]P<F]P97)T:65S+F1MD=UJA# 0A:]7
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 at N4[S[[R;,<W306T-^7K!D8D4 at -"
M*48P=S0+H?C7SR)^YYD\83&.DU&,JTY%&;%WISL at Y _C%"]\JT8\0A\TN"LS
MKSI=?U6J0TD#EVBG=O*.9X8MX,*(18=$OD136TAH at 84BW1>I0A/8V1 at H@RP7
MX=T#+#ZV[JT`XJXB]MH.5>_\&#+L_^*<(/V!%W0.A>H8\*E)C#?:'U-**%,"
MCSQ["X>M$>LX6+,*+>X/4$L!`A0`"@``````1;5V-0````````````````8`
M```````````0`````````&1T97-T+U!+`0(4`!0````(`/6T=C707-D5 at 0``
M`, ````/````````````( ```"0```!D=&5S="]B=6EL9"YB87102P$"% `4
M````" #-M'8U$5)^N38````W````# ```````````" ```#2````9'1E<W0O
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```````````" ```#>`0``9'1E<W0O;6]D
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




More information about the Digitalmars-d-bugs mailing list