Packages / imports & references between modules

kdevel kdevel at vogtner.de
Sun Apr 28 16:18:59 UTC 2019


On Sunday, 28 April 2019 at 14:24:08 UTC, Robert M. Münch wrote:
> On 2019-04-28 11:44:03 +0000, Mike Parker said:
>
>> They're different symbols because they're in different 
>> modules. The module and package name is part of the symbol 
>> name.
>
> Ok, that's what I assumed too.
>
>>  Just import A.b in A.a.
>
> Won't help. I just commented the lines DStep generated for 
> forward referenced structs.

This compiles with dmd v2.085.1:

$ cat A/a.d
module A.a;
import A.b;

$ cat A/b.d
module A.b;
struct myStruct {
    int i;
}

$ cat A/c.d
module A.c;
import A.a;
import A.b;

struct myOtherStruct {
    myStruct ms;
}

void main ()
{
    import std.stdio;
    myOtherStruct mos;
    mos.writeln;
}




More information about the Digitalmars-d-learn mailing list