Packages / imports & references between modules
Mike Parker
aldacron at gmail.com
Sun Apr 28 11:44:03 UTC 2019
On Sunday, 28 April 2019 at 11:12:50 UTC, Robert M. Münch wrote:
>
> One more problem now showing up, when I do this:
>
> A/a.d
> module A.a;
> struct myStruct;
>
> A/b.d
> module A.b;
> struct myStruct {...}
>
> A/c.d
> module A.c;
> import A;
> struct myOtherStruct {
> myStruct ms;
> }
>
> I now get an error in file A/c.d that a.a.myStruct conflicts
> with a.b.myStruct. Looks like these symbols are different for
> D. Is there a way to tell D that one is only a forward
> reference and is the same when D sees the struct declaration
> later?
They're different symbols because they're in different modules.
The module and package name is part of the symbol name. Just
import A.b in A.a.
More information about the Digitalmars-d-learn
mailing list