On 7/29/2018 1:52 PM, Manu wrote:
On Sun, 29 Jul 2018 at 05:10, kinke via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
[...]
so that a straight C++ namespace => D module hierarchy mapping
would probably be required in the general case:
```
// cppns/package.d
module cppns;
extern(C++, "cppns") { void foo(); }
// cppns/nested/package.d
module cppns.nested;
extern(C++, "cppns") extern(C++, "nested") { void foo(); }
```
It's beautiful!
You must have missed my other post:
====================================================
Here's another method:
------
extern (C++, ns) { int foo() { return 1; } }
mixin template X()
{
extern (C++, ns) { int bar() { return 2; } }
}
mixin X!() x;
-------
and another:
-----
extern (C++, ns) { int foo() { return 1; } }
struct S
{
extern (C++, ns) { int bar() { return 2; } }
}
----