AA rehash link error

Adam D. Ruppe destructionator at gmail.com
Thu Aug 16 15:01:43 PDT 2012


You're not doing anything wrong, this is an old bug that shows up 
at random.

I worked around it in my cgi.d by writing a function like this:


// Referencing this gigantic typeid seems to remind the compiler
// to actually put the symbol in the object file. I guess the 
immutable
// assoc array array isn't actually included in druntime
void hackAroundLinkerError() {
       
writeln(typeid(const(immutable(char)[][])[immutable(char)[]]));
       writeln(typeid(immutable(char)[][][immutable(char)[]]));
       writeln(typeid(Cgi.UploadedFile[immutable(char)[]]));
       
writeln(typeid(immutable(Cgi.UploadedFile)[immutable(char)[]]));
       
writeln(typeid(immutable(Cgi.UploadedFile[])[immutable(char)[]]));
       writeln(typeid(immutable(char[])[immutable(char)[]]));
       // this is getting kinda ridiculous btw. Moving assoc arrays
       // to the library is the pain that keeps on coming.

       // eh this broke the build on the work server
       // writeln(typeid(immutable(char)[][immutable(string[])]));
       writeln(typeid(immutable(string[])[immutable(char)[]]));
}



I never call that function, its simple presence is all that's 
needed.

You should be able to do the same. Try dropping this at the 
bottom of your file with the definition:

void hackAroundLinkerError() {
     writeln(typeid(immutable Cmd[string]));
}



Or some similar variant and see if it works.


More information about the Digitalmars-d-learn mailing list