www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - (0.102) A problem with mixins and compiling to OBJ/LIB.

reply "Ilya Zaitseff" <sark7 mail333.com> writes:
A problem with mixins and compiling to OBJ/LIB.

<testmod.d>
template TFoo()
{
	void foo() {}
}

struct Bar
{
	mixin TFoo!();
	void bar() {}
}

<testmain.d>
import testmod;

void main()
{
	Bar f;
	f.foo();
}

DMD -c TESTMOD.D (Step X)
LIB -c TESTMOD.LIB TESTMOD.OBJ
DMD TESTMAIN.D TESTMOD.LIB

DMD 0.102 gives link error:

testmain.obj(testmain)
  Error 42: Symbol Undefined _D7testmod3Bar03fooFZv

Yeah, because foo() is not in .lst from testmod.lib (LIB -l TESTMOD.LIB):

Publics by name		module
__init_7testmod3Bar              testmod
_array_7testmod                  testmod
_assert_7testmod                 testmod
_D7testmod3Bar3barFZv            testmod

But, if we do (Step X) with DMD 0.101, all works perfect, and .lst is:

Publics by name		module
__init_7testmod3Bar              testmod
_array_7testmod                  testmod
_assert_7testmod                 testmod
_D7testmod3Bar03fooFZv           testmod
_D7testmod3Bar3barFZv            testmod
-- 
îÁÐÉÓÁÎÏ × ÐÏÞÔÏ×ÏÍ ËÌÉÅÎÔÅ ÂÒÁÕÚÅÒÁ Opera: http://www.opera.com/m2/
Oct 06 2004
next sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
"Ilya Zaitseff" <sark7 mail333.com> escribió en el mensaje 
news:opsff7sxywaaezs2 localhost...
|A problem with mixins and compiling to OBJ/LIB.
|
| <testmod.d>
| template TFoo()
| {
| void foo() {}
| }
|
| struct Bar
| {
| mixin TFoo!();
| void bar() {}
| }
|
| <testmain.d>
| import testmod;
|
| void main()
| {
| Bar f;
| f.foo();
| }
|
| DMD -c TESTMOD.D (Step X)
| LIB -c TESTMOD.LIB TESTMOD.OBJ
| DMD TESTMAIN.D TESTMOD.LIB
|
| DMD 0.102 gives link error:
|
| testmain.obj(testmain)
|  Error 42: Symbol Undefined _D7testmod3Bar03fooFZv
|
| Yeah, because foo() is not in .lst from testmod.lib (LIB -l TESTMOD.LIB):
|
| Publics by name module
| __init_7testmod3Bar              testmod
| _array_7testmod                  testmod
| _assert_7testmod                 testmod
| _D7testmod3Bar3barFZv            testmod
|
| But, if we do (Step X) with DMD 0.101, all works perfect, and .lst is:
|
| Publics by name module
| __init_7testmod3Bar              testmod
| _array_7testmod                  testmod
| _assert_7testmod                 testmod
| _D7testmod3Bar03fooFZv           testmod
| _D7testmod3Bar3barFZv            testmod
| -- 
| îÁÐÉÓÁÎÏ × ÐÏÞÔÏ×ÏÍ ËÌÉÅÎÔÅ ÂÒÁÕÚÅÒÁ Opera: http://www.opera.com/m2/

I think that's the bug Matthew reported, and that I'm also having. Thanks for 
trimming it down!

-----------------------
Carlos Santander Bernal 
Oct 06 2004
prev sibling parent "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
Ilya Zaitseff schrieb:
 A problem with mixins and compiling to OBJ/LIB.

 <testmod.d>
 template TFoo()
 {
 void foo() {}
 }

 struct Bar
 {
 mixin TFoo!();
 void bar() {}
 }

 <testmain.d>
 import testmod;

 void main()
 {
 Bar f;
 f.foo();
 }

 DMD -c TESTMOD.D (Step X)
 LIB -c TESTMOD.LIB TESTMOD.OBJ
 DMD TESTMAIN.D TESTMOD.LIB

 DMD 0.102 gives link error:

 testmain.obj(testmain)
   Error 42: Symbol Undefined _D7testmod3Bar03fooFZv
Can someone reproduce this bug under Linux? I tried to reproduce it but failed to do so. Thomas
Oct 16 2004