On 2016-01-08 06:14, Manu via Digitalmars-d wrote:

Again, this is looking at the simple case. The details and more
complex scenarios start to reveal problems.

If the same C++ namespace is present in multiple modules, that is,
x.ns and y.ns, you want to 'import x, y;', the symbols from x and y
are imported into the local module scope, but now you have a name
conflict on 'ns'. Does the imported 'ns' refer to x.ns or y.ns? This
case is everywhere, since every module with extern(C++, ns) will have
the same top-level symbol.

This is what I have found out:

module foo;

extern(C++, ns)
{
    int a();
}

module bar;

extern(C++, ns)
{
    int b();
}

module main;

import foo;
import bar;

extern(C++, ns)
{
    int c();
}

void main()
{
    a();
    b();
    c();

    // ns.a(); // does not work
    foo.ns.a();
    ns.c();
}

"ns.a()" works if there is no other extern(C++, ns), either in "main" or "bar". Is that working for you, or do you have more complex examples where the above doesn't work?

Walter, should "ns.a()" work in the above example?

--
/Jacob Carlborg

Reply via email to