any tool to at least partially convert C++ to D (htod for source
Walter Bright
newshound1 at digitalmars.com
Fri Mar 12 10:41:30 PST 2010
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.
More information about the Digitalmars-d
mailing list