On 2014-04-01 20:01, Rene Zwanenburg wrote:
On Tuesday, 1 April 2014 at 17:49:21 UTC, monnoroch wrote:
I mean, it would be just super cool. At my work we have like gigabytes
of c++ code, and almost all of it in namespaces, if i just could write
simple extern(C++) declarations for them it would be so much easier to
start working with D.

If you know how your C++ compiler mangles functions inside namespaces,
you should be able to hack something together using pragma mangle. I'm
not sure how nice it can be, ideally a UDA (user defined attribute)
should be enough, but I've never used them myself so I don't know if
this is possible:

@Cpp("namespace") void foo(int x);

or even:

@Cpp("namespace")
{
   void foo();
   void bar();
}

where @Cpp applies extern(C++) and pragma(mangle,
"correctlymangledname"). Anyone knows if this can be done?

That's not currently possible. Have a look at this: http://wiki.dlang.org/DIP50#C.2B.2B_Namespaces_.28issue_7961.29

--
/Jacob Carlborg

Reply via email to