digitalmars.D.bugs - [0.89 linux]Template alias
- Stephan Wienczny (3/3) May 20 2004 The attached files compile but do not link. There is an undefined refere...
-
Carlos Santander B.
(14/14)
May 20 2004
"Stephan Wienczny"
escribió en el mensaje - Stephan Wienczny (4/17) May 21 2004 Do you use Windows? Then this might be a linux only bug. I'm pretty sure...
- Stephan Wienczny (5/8) May 21 2004 I looked at the files using nm.
- Stephan Wienczny (4/62) May 29 2004 Template instances are still not handled correctly on Linux.
The attached files compile but do not link. There is an undefined reference to the template constructor. If I copy it into one file it works...
May 20 2004
"Stephan Wienczny" <Stephan Wienczny.de> escribió en el mensaje news:c8jhfj$nfd$1 digitaldaemon.com | The attached files compile but do not link. There is an undefined reference | to the template constructor. | If I copy it into one file it works... Works for me: dmd modules.d token.d Probably you're forgetting to put "token.d". Don't, so it'll get linked. Another option: dmd -c modules token link modules.obj token.obj ----------------------- Carlos Santander Bernal
May 20 2004
Do you use Windows? Then this might be a linux only bug. I'm pretty sure that the file is linked in. Stephan Carlos Santander B. wrote:Works for me: dmd modules.d token.d Probably you're forgetting to put "token.d". Don't, so it'll get linked. Another option: dmd -c modules token link modules.obj token.obj ----------------------- Carlos Santander Bernal
May 21 2004
Stephan Wienczny wrote:The attached files compile but do not link. There is an undefined reference to the template constructor. If I copy it into one file it works...I looked at the files using nm. nm showed that the undefined references are local symbols instead of global ones. Stephan
May 21 2004
Template instances are still not handled correctly on Linux. The compiler generates lokal symbols for template instances. This is the reason why you can't link it. Stephan Wienczny wrote:The attached files compile but do not link. There is an undefined reference to the template constructor. If I copy it into one file it works... ------------------------------------------------------------------------ import std.file, std.stream, token; int main(char[][] argv) { new IntToken(32, null); return 0; } ------------------------------------------------------------------------ class Location { } class Token { this(Location _loc) { loc = _loc; } Location loc; } class NumberToken(T) : public Token { T value; // char[] suffix; this(T _value/*, char[] _suffix*/, Location _loc) { super(_loc); value = _value; // suffix = _suffix; } } alias NumberToken!(int) IntToken; alias NumberToken!(uint) UIntToken; alias NumberToken!(long) LongToken; alias NumberToken!(ulong) ULongToken; alias NumberToken!(real) RealToken; alias NumberToken!(ireal) IRealToken;
May 29 2004