extern(C++, ns) is wrong

Manu turkeyman at gmail.com
Wed Sep 5 00:35:50 UTC 2018


On Tue, 4 Sep 2018 at 17:30, tide via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Tuesday, 4 September 2018 at 23:32:31 UTC, Walter Bright wrote:
> > On 9/4/2018 3:33 PM, Manu wrote:
> >> file1.d
> >> ---------
> >> module bliz.ecs.component_access;
> >> import bliz.ecs.table;
> >> import bliz.ecs.types;
> >> extern(C++, bliz):
> >> // things...
> >>
> >> Error: project\ecs\include\d2\bliz\ecs\component_access.d(7):
> >> Error:
> >> namespace `bliz.ecs.component_access.bliz` conflicts with
> >> import
> >> `bliz.ecs.component_access.bliz` at
> >> project\ecs\include\d2\bliz\ecs\component_access.d(3)
> >>
> >> file2.d
> >> ---------
> >> module bliz.ecs.table;
> >> import bliz.ecs.types;
> >> extern(C++, bliz):
> >> // things...
> >>
> >> Error: project\ecs\include\d2\bliz\ecs\table.d(11): Error:
> >> namespace
> >> `bliz.ecs.table.bliz` conflicts with import
> >> `bliz.ecs.table.bliz` at
> >> project\ecs\include\d2\bliz\ecs\table.d(5)
> >
> > I can't help because the examples are incomplete. There is no
> > line 5 in table.d, nor a line 7 in component_access.d The error
> > messages are not generated from the code posted.
>
> That's all you need really, any symbol you add will cause the
> error.
>
> extern(C++, bliz):
>
> created a symbol "bliz", you can't import a package from "bliz"
> cause then there's a symbol clash. I thought you implemented
> extern(C++) ...

And yes, the example is actually complete. Again, but I'll simplify
the filenames:

ns/bar.d
-------------
module ns.bar;
import ns.baz;
extern(C++, ns):

ns/baz.d
-------------
module ns.baz;
import ns.bar;
extern(C++, ns):


> dmd ns/bar.d ns/baz.d


More information about the Digitalmars-d mailing list