Michel Fortin wrote:
What I meant is that this is dependent on link order (and I tested it):

module a;
import a_base;
import b;
int ai;
extern(C) void initA() { ai = bi+2; }

module a_base;
extern(C) void initA();
static this() { initA(); }

module b;
import b_base;
import a;
int bi;
extern(C) void initB() { bi = ai+4; }

module b_base;
extern(C) void initB();
static this() { initB(); }

module main;
import b;
import a;
import std.stdio;
void main() {
    writeln("a.ai = ", ai, "  b.bi = ", bi);
}

True, when you use:

   extern (C) void initA();

instead of importing the module that declares initA(), you totally defeat the dependency checking, because the dependency checking is based on the import statements.

Reply via email to