[Issue 7961] Add support for C++ namespaces

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 10 04:43:57 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=7961



--- Comment #10 from yebblies <yebblies at gmail.com> 2013-11-10 23:43:55 EST ---
(In reply to comment #9)
> (In reply to comment #8)
> 
> > We would have to mangle in the function name and type as well.  Not really
> > something you want to do manually.
> 
> No, right. This doesn't work either due to forward reference:
> 
> pragma(mangle, namespace!("bar", foo)) void foo ();
> 
> Is this something we want to, and can, make work? I'm just trying to come up
> with a solution that doesn't require a compiler change or a change that can be
> applied more generally.

> pragma(mangle, namespace!("bar", "foo", void function())) extern(C++) void foo ();

The way to do it is to generate both the pragma(mangle) args and the function
signature from the same source.  But really, pragma(mangle) is too blunt a tool
for this.

Especially considering you'd usually want to apply the namespace to a whole
bunch of declarations.

It might also be worth considering the behavior of

pragma(cpp_namespace, "foo")
pragma(cpp_namespace, "bar")
extern(C++) void baz();

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list