link errors with 0.149, templates, and writefln

Kevin Bealer Kevin_member at pathlink.com
Sun Mar 12 23:39:05 PST 2006


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;
: }
:

Kevin Bealer





More information about the Digitalmars-d-bugs mailing list