Currently,
extern (Windows) int foo(int a, int b);
mangles on non-Windows systems as:
foo@16
This doesn't really make any sense or have any use. It is not compatible with anything.
I propose changing it to behave like extern(C). This has the advantage that there is significant C code out there that mangles with Windows on Windows and otherwise C, and this will make these sorts of things easily compatible with D declarations.
It will require recompiling of any non-Windows libraries that use extern(Windows).
Comment #1 by yebblies — 2014-06-12T00:34:24Z
Have you forgotten about `extern(System)` ?
Comment #2 by bugzilla — 2014-06-12T01:34:22Z
(In reply to yebblies from comment #1)
> Have you forgotten about `extern(System)` ?
Yes :-)
But it isn't quite right, it should be equivalent to extern(C) for Win64, too.
And extern(Windows) is still pointless on non-Windows systems.
Comment #3 by dfj1esp02 — 2014-06-13T09:46:21Z
(In reply to Walter Bright from comment #0)
> I propose changing it to behave like extern(C). This has the advantage that
> there is significant C code out there that mangles with Windows on Windows
> and otherwise C, and this will make these sorts of things easily compatible
> with D declarations.
Refactoring will be easy: replace all extern(Windows) with extern(System).
That said, we can probably have extern(System) in core.sys.windows too.
Comment #4 by bugzilla — 2014-06-20T06:06:24Z
Yes, this seems unnecessary.
Comment #5 by dfj1esp02 — 2017-01-30T10:35:41Z
UnixODBC uses windows calling convention on non-Windows systems.