link errors with 0.149, templates, and writefln

Kevin Bealer Kevin_member at pathlink.com
Tue Mar 14 13:21:13 PST 2006


In article <8gpje3-v6b.ln1 at birke.kuehne.cn>, Thomas Kuehne says...
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Kevin Bealer schrieb am 2006-03-13:
>>
>> When I try to compile the following two files, I get a working program, but if
>> the unused function "quux" is removed, the compile fails with a symbol error at
>> link time.  It looks like the writefln() in quux brings in the necessary symbols
>> but the similar writefln() in the template does not do so.
>>
>> This does not seem to be related to IFTI -- if I change that the error still
>> seems to happen.
>>
>> NOTE: this is on a 64 bit machine in Linux, so I need to manually link with gcc
>> using a slight variant of the "gcc" command that dmd uses.  I can provide more
>> data on this if needed.
>>
>> The compiler is DMD 0.149 for Linux.
>>
>> The errors look like this:
>>
>> /home/marlon/src/dscript/trydmd1.d:8: undefined reference to `_arguments_Aad'
>> /home/marlon/src/dscript/trydmd1.d:8: undefined reference to `_arguments_Aad'
>>
>>>> autotmp.d
>>:
>>: import std.stdio;
>>:
>>: template foo(f1)
>>: {
>>:     void foo(f1 x)
>>:     {
>>:         writefln("no dice, chicago, %s.", x);
>>:     }
>>: }
>>:
>>:
>>>> trydmd1.d
>>:
>>: import std.stdio;
>>: import autotmp;
>>:
>>: // removal of the quux function breaks the compile
>>: //void quux(int x)
>>: //{
>>: //   double foo = x + 4;
>>: //    writefln("no dice %s.", foo);
>>: //}
>>:
>>: int main(char[][] args)
>>: {
>>:     foo(-29.0);
>>:
>>:     if (args.length > 1) {
>>:         writefln("%s", args[1]);
>>:     }
>>:     return 0;
>>: }
>>:
>
>FAIL:
>dmd -c autotmp.d
>dmd -c trydmd1.d
>dmd autotmp.o trydmd1.o
>
>PASS:
>dmd autotmp.d trydmd1.d
>
>Added to DStress as
>http://dstress.kuehne.cn/complex/arguments
>
>(It's a "complex" target due to its multistage build process.)
>
>Thomas
>
>
>-----BEGIN PGP SIGNATURE-----
>
>iD8DBQFEFzbn3w+/yD4P9tIRAnQ2AJ4zzHnyhJVk4YrsPltMELI0JWDy1QCfaQKC
>4QtePXTq+7sodj+t6+YMq7I=
>=cSmb
>-----END PGP SIGNATURE-----

Thanks.  I didn't realize that multistage compilation was the trigger.

Kevin





More information about the Digitalmars-d-bugs mailing list