Is there any good reason why C++ namespaces are "closed" in D?
rikki cattermole
rikki at cattermole.co.nz
Thu Aug 2 09:05:30 UTC 2018
On 02/08/2018 8:59 PM, Walter Bright wrote:
> If this problem were to be solved, it should be solved, not hacked for
> one case only. There are many ways of dealing with it:
>
> 1. pragma(mangle)
>
> 2. change the names in the C/C++ side
>
> 3. use a macro -Dwith=with_ when compiling the C/C++ code
>
> 4. write wrappers/forwarders/trampolines in C/C++, compile them and link
> them in
>
> 5. write a tool that patches the object file (not as hard as it sounds,
> the symbol table is usually in one spot, but of course the patcher would
> have to be implemented for each object file format). I've written object
> file patchers before, they work surprisingly well. Nobody else does it,
> presumably because the thought inspires terror :-)
>
> 6. provide some switch to the D compiler to rename A=>B in the object
> file symbols, though I'd worry such would slow the compiler down
>
> 7. perhaps amend the language such that an identifier of the form
> "__keyword" would appear in the object file as "keyword".
8. if any identifier starts with a keyword and ends with at minimum one
_, one _ from the end of the identifier will be removed for mangling
(but not e.g. lookup).
More information about the Digitalmars-d
mailing list