Command Line Order + Linker Errors

Rainer Schuetze r.sagitario at gmx.de
Mon Oct 29 16:03:51 PDT 2012



On 10/29/2012 10:24 PM, dsimcha wrote:
> The mesasges are below.  The exact messages are probably not useful but
> I included them since you asked.  I meant to specify, though, that
> they're all "undefined reference" messages.
>
> Actually, none of these issues occur at all when compilation of the two
> files is done separately, regardless of what order the object files are
> passed to DMD for linking:
>
> dmd -c -unittest test.d
> dmd -c -unittest emptymain.d
> dmd -unittest test.o emptymain.o  # Works
> dmd -unittest emptymain.o test.o  # Works
>
> emptymain.o:(.data._D68TypeInfo_S6object26__T16AssociativeArrayTdTdZ16AssociativeArray4Slot6__initZ+0x80):
> undefined reference to
> `_D11gctemplates77__T11RTInfoImpl2TS6object26__T16AssociativeArrayTdTdZ16AssociativeArray4SlotZ11RTInfoImpl2yG2m'

I had similar ones aswell. As reported in some other mail, the 
workaround is to create an alias to the AssociativeArray type.

double[double] aa;
alias AssociativeArray!(double,double) _workaround;

It seems the compiler does not always completely instantiate the class 
AssociativeArray!(Key,Value) when the type Value[Key] is used. 
Definitely a compiler bug.


More information about the Digitalmars-d mailing list