pragma(mangle) on types
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 11 06:25:24 PDT 2017
On Tuesday, 11 July 2017 at 13:14:39 UTC, Moritz Maxeiner wrote:
> On Tuesday, 11 July 2017 at 07:28:59 UTC, Jacob Carlborg wrote:
>> In D it's possible to use pragma(mangle) on a function to set
>> the name that will actually end up in the binary. This is
>> useful if you need to link to a C function that uses the same
>> name as a keyword in D.
>>
>> I think we need the same thing for types as well. This is
>> important when binding to C++ and Objective-C.
>>
>> [...]
>
> [...]
> Manually matching C++ mangling schemes doesn't strike me as the
> best option, but I also don't know how to do it better (other
> than the workaround above).
Thinking about this a bit more it might make sense to introduce
another pragma, e.g.
`pragma(name, "...")`, which would essentially mean "the
identifier used in the declaration this pragma applies to is
chosen for identifier restrictions in D; use the identifier
specified by the pragma as the starting point for mangling
instead",
More information about the Digitalmars-d
mailing list