Thread overview
(0.102) A problem with mixins and compiling to OBJ/LIB.
Oct 06, 2004
Ilya Zaitseff
Oct 16, 2004
Thomas Kuehne
October 06, 2004
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/
October 06, 2004
"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


October 16, 2004
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