pragma(mangle)

Nick Sabalausky a at a.a
Sat Jun 11 14:12:36 PDT 2011


"Daniel Murphy" <yebblies at nospamgmail.com> wrote in message 
news:it0kh7$2v1r$1 at digitalmars.com...
> Stealing the idea from http://d.puremagic.com/issues/show_bug.cgi?id=2698, 
> I've implemented pragma(mangle).
>
> Basically,
> pragma(mangle, "_mangled__name_")
> void myfunction() {}
>
> Will cause the compiler to use "_mangled__name_" as the function's mangle 
> string.
>
> Would many people find this a useful thing to have in the compiler?
>
> Also, does anybody know what set of characters to accept in a mangle 
> string?

It sounds like it may have great potential for working around hashed 
mangles. And maybe for exposing an API to another link-compatible language 
like C (or not, I don't know, maybe extern(C) is always good enough for 
that?).

Two possible problems I can see:

1. Can it be reliably demangled? If not, I think that would severely hinder 
its usefulness.

2. What if "myfunction" is templated?





More information about the Digitalmars-d mailing list