plans for interfacing to C++

Martin Nowak dawg at dawgfoto.de
Tue Jan 10 03:44:29 PST 2012


On Tue, 10 Jan 2012 10:28:54 +0100, deadalnix <deadalnix at gmail.com> wrote:

> Le 09/01/2012 19:19, Trass3r a écrit :
>> On Monday, 9 January 2012 at 18:04:58 UTC, Michel Fortin wrote:
>>>> Hmm another difficulty is how to switch between mangling schemes.
>>>
>>> One thing that could be done is instead of the namespace argument,
>>> have a mangled name argument. Then use CTFE to build the mangled name
>>> (if you want to).
>>>
>>> This would also solve the problem we have on OS X where some C
>>> functions use a mangled name with a '$' in them thanks to the use of
>>> some GCC attribute in the system headers.
>>>
>>> Or maybe it should be a pragma instead.
>>
>> Interesting idea. But how to do it properly?
>> A namespace or a class may have lots of functions and I really wouldn't
>> want to be forced to write pragma(mangledName, gccmangle("Bla", ...))
>> before every declaration.
>
> @mangled("encrypted klingon here") void foo();
>
> Where encrypted klingon can be generated using CTFE.

Quite nice.
It also makes pretty clear that one is responsible to
avoid symbol collisions.


More information about the Digitalmars-d mailing list