digitalmars.D.bugs - linux linking error with interfaces
- Ben Hinkle <bhinkle4 juno.com> Jul 17 2004
I've been poking around with porting the Classpath implementation of Java's
Collection Framework and have bumped up against the following linux bug:
interface Iterator(T) {}
interface Iterable(T) {
Iterator!(T) foo();
}
class List(T) : Iterable!(T) {
Iterator!(T) foo() {return new ListIterator!(T);}
}
class ListIterator(T) : Iterator!(T) {}
int main() {
List!(int) x = new List!(int);
return 0;
}
compile with dmd-0.95 on linux gives
gcc foo.o -o foo -lphobos -lpthread -lm
foo.o(.gnu.linkonce.d._Class_3foo14ListIterator_i12ListIterator+0x3c):
undefined reference to `_Interface_3foo10Iterator_i8Iterator'
collect2: ld returned 1 exit status
--- errorlevel 1
I haven't tried on Windows. I haven't found any workarounds.
-Ben
Jul 17 2004








Ben Hinkle <bhinkle4 juno.com>