I got no response in the 'learn' section, so I am reposting here. I think this must be a bug..

When building my program by compiling .o files first and then
linking, everything links fine, but when I try to compile all the
source files at once, I get the following link error:

build/debug/dboss-debug.o: In function `@property
boss.proc.proccmd.ProcCmd.Cmd[immutable(char)[]]
object.AssociativeArray!(immutable(char)[],
boss.proc.proccmd.ProcCmd.Cmd).AssociativeArray.rehash()':
/usr/include/dmd/druntime/import/object.di:465: undefined
reference to
`_D44TypeInfo_HAyaC4boss4proc7proccmd7ProcCmd3Cmd6__initZ'

The AA in question is a static class member declared as follows:

  static immutable Cmd[string] m_cmds;

And Cmd is a class defined in the same class:

  static class Cmd {
    alias string function(ProcCmd c, string[] args) fExec;

    string  m_cmd;   //Invocation name
    string  m_desc;  //Description of command
    fExec   m_exec;  //Function implementing command

    this(string cmd, string desc, fExec exec) {
      m_cmd = cmd;
      m_desc = desc;
      m_exec = exec;
    }
  }

What is happening? This is working perfectly fine when
building object files before linking.

Reply via email to