D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12894 - Make extern(Windows) behave like extern(C) on non-Windows systems
Summary: Make extern(Windows) behave like extern(C) on non-Windows systems
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-11 22:15 UTC by Walter Bright
Modified: 2017-01-30 10:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2014-06-11 22:15:25 UTC
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 yebblies 2014-06-12 00:34:24 UTC
Have you forgotten about `extern(System)` ?
Comment 2 Walter Bright 2014-06-12 01:34:22 UTC
(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 anonymous4 2014-06-13 09:46:21 UTC
(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 Walter Bright 2014-06-20 06:06:24 UTC
Yes, this seems unnecessary.
Comment 5 anonymous4 2017-01-30 10:35:41 UTC
UnixODBC uses windows calling convention on non-Windows systems.