Should C linkage (aka "extern (C)") be the default when using "betterC"?
rempas
rempas at tutanota.com
Sat Mar 5 13:31:30 UTC 2022
On Saturday, 5 March 2022 at 12:34:20 UTC, meta wrote:
> I misread rikki's comment
>
> Loosing function overloading is indeed problematic, so it's not
> a so good idea..
You will lose function overloading anyway if you want to export
you binding to the "C" way of mangling symbols (which is not
mangling them at all). So if you want to have your library used
from other languages without any more effort, you won't use
function overloading or templates anyway!
From the other hand, you can use D linkage in these symbols and
then create an "interface" (or have someone else do that for you,
lol!) with C linkage symbols that will call the overloaded
functions or the template symbols. This is how I would do it!
The problem to my original post is that like Rikki said, it would
be hard to make "extern(C)" the default without also modifying
the module system.
More information about the Digitalmars-d
mailing list