extern(C++, NS)

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 29 03:22:31 PST 2015


On Sunday, 29 November 2015 at 10:58:48 UTC, Manu wrote:
> On 29 November 2015 at 20:17, Iain Buclaw via Digitalmars-d
>> I think your idea with aliases was just wishful thinking, 
>> aliases themselves never worked like that.
>
> I thought aliases did produce a symbol in the scope they are 
> declared?
> Or do you mean with the private thing? Yeah...
> Aliases are often used to sort out these sorts of 
> scope/namespacing
> issues, I've seen it come up lots of times.

I remember when this feature was under discussion, I tried to 
argue against extern c++ creating a new scope, but alas no avail. 
So my current workaround looks something like this(but I didn't 
use it on a large scale yet):

private static struct Hidden
{
public:
     extern(C++, std) int fun();
}

// autogenerate all aliases with 'static foreach'?
alias fun = Hidden.std.fun;

if only static foreach would get accepted one day...



More information about the Digitalmars-d mailing list