Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 21, 2004 [0.89 linux]Template alias | ||||
---|---|---|---|---|
| ||||
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 21, 2004 Re: [0.89 linux]Template alias | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | "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 21, 2004 Re: [0.89 linux]Template alias | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 Re: [0.89 linux]Template alias | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | 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 29, 2004 [0.9.1 linux] was [0.89 linux]Template alias | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan Wienczny | 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;
>
|
Copyright © 1999-2021 by the D Language Foundation