digitalmars.D - extern(Windows) behavior on non-Windows systems
- Walter Bright (3/3) Jun 11 2014 I've got an enhancement request to have it behave like extern(C):
- deadalnix (3/7) Jun 11 2014 What is the extern(Windows) is supposed to do differently on
- Walter Bright (3/11) Jun 11 2014 It changes the calling convention and name mangling to match what Micros...
- deadalnix (4/6) Jun 11 2014 OK, but I don't get why you wouldn't be able to use
- Walter Bright (3/9) Jun 11 2014 http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx
- Iain Buclaw via Digitalmars-d (6/9) Jun 11 2014 I'd doubt there's be anyone that uses extern(Windows) on non-windows
- Walter Bright (2/6) Jun 11 2014 Even Microsoft gave up on stdcall for Win64 and uses the C convention.
- Adam D. Ruppe (4/6) Jun 11 2014 I think that's because the 64 bit C convention is a lot closer to
- Walter Bright (5/9) Jun 11 2014 I just think that the purpose of having a separate Windows API calling
- Iain Buclaw via Digitalmars-d (3/14) Jun 11 2014 Honestly, I'd first deprecate/remove extern(Pascal), then think about
- FreeSlave (13/16) Jun 12 2014 I agree. Does anyone use extern(Pascal)? It's piece of old
- Chris Williams (10/14) Jun 11 2014 No, but if I had a 3rd party .lib that had been built on Windows
- Jonathan M Davis via Digitalmars-d (6/9) Jun 11 2014 Regardless of what extern(Windows) is supposed to do on Windows systems,...
- Kapps (4/8) Jun 11 2014 Isn't this the whole point of extern(System)? I don't really see
- =?UTF-8?B?Ikx1w61z?= Marques" (15/19) Jun 12 2014 That example of "I want this calling convention on platform X and
I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?
Jun 11 2014
On Wednesday, 11 June 2014 at 22:20:27 UTC, Walter Bright wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?What is the extern(Windows) is supposed to do differently on windows than existing externs ?
Jun 11 2014
On 6/11/2014 3:24 PM, deadalnix wrote:On Wednesday, 11 June 2014 at 22:20:27 UTC, Walter Bright wrote:It changes the calling convention and name mangling to match what Microsoft uses for the Windows API.I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?What is the extern(Windows) is supposed to do differently on windows than existing externs ?
Jun 11 2014
On Wednesday, 11 June 2014 at 22:25:22 UTC, Walter Bright wrote:It changes the calling convention and name mangling to match what Microsoft uses for the Windows API.OK, but I don't get why you wouldn't be able to use extern(C/C++/Whatever) and it adapt to the system. Obviously there is something about windows that I'm not really aware of.
Jun 11 2014
On 6/11/2014 3:27 PM, deadalnix wrote:On Wednesday, 11 June 2014 at 22:25:22 UTC, Walter Bright wrote:That's what it does now.It changes the calling convention and name mangling to match what Microsoft uses for the Windows API.OK, but I don't get why you wouldn't be able to use extern(C/C++/Whatever) and it adapt to the system.Obviously there is something about windows that I'm not really aware of.http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx
Jun 11 2014
On 11 June 2014 23:20, Walter Bright via Digitalmars-d <digitalmars-d puremagic.com> wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?I'd doubt there's be anyone that uses extern(Windows) on non-windows systems, but there may be people who wish to force stdcall for whatever reason. Currently, extern(C) on Windows could either be a stdcall, cdecl or thiscall function.
Jun 11 2014
On 6/11/2014 4:17 PM, Iain Buclaw via Digitalmars-d wrote:I'd doubt there's be anyone that uses extern(Windows) on non-windows systems, but there may be people who wish to force stdcall for whatever reason. Currently, extern(C) on Windows could either be a stdcall, cdecl or thiscall function.Even Microsoft gave up on stdcall for Win64 and uses the C convention.
Jun 11 2014
On Wednesday, 11 June 2014 at 23:27:09 UTC, Walter Bright wrote:Even Microsoft gave up on stdcall for Win64 and uses the C convention.I think that's because the 64 bit C convention is a lot closer to the stdcall convention anyway, putting more args in registers etc...
Jun 11 2014
On 6/11/2014 4:34 PM, Adam D. Ruppe wrote:On Wednesday, 11 June 2014 at 23:27:09 UTC, Walter Bright wrote:I just think that the purpose of having a separate Windows API calling convention no longer makes any sense. It dates back to the 16 bit world when Pascal had a different calling convention and a lot of people thought that was better.Even Microsoft gave up on stdcall for Win64 and uses the C convention.I think that's because the 64 bit C convention is a lot closer to the stdcall convention anyway, putting more args in registers etc...
Jun 11 2014
On 12 June 2014 00:17, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 11 June 2014 23:20, Walter Bright via Digitalmars-d <digitalmars-d puremagic.com> wrote:Honestly, I'd first deprecate/remove extern(Pascal), then think about deprecating extern(Windows) later.I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?I'd doubt there's be anyone that uses extern(Windows) on non-windows systems, but there may be people who wish to force stdcall for whatever reason. Currently, extern(C) on Windows could either be a stdcall, cdecl or thiscall function.
Jun 11 2014
On Wednesday, 11 June 2014 at 23:19:43 UTC, Iain Buclaw via Digitalmars-d wrote:Honestly, I'd first deprecate/remove extern(Pascal), then think about deprecating extern(Windows) later.I agree. Does anyone use extern(Pascal)? It's piece of old history, and now it's more discouraging than useful, because it seems like the way to link D program with Pascal code, but today there are pascal compilers with incompatible mangling (just like C++ ones). For example, extern(Pascal) will not work with FreePascal as I recall. And yes, there is extern(System) already for described purpose. It would be just weird to allow extern(Windows) work on non-Windows systems (just because of the name). Even if it can be useful by some reason, it needs to have another name (extern(Microsoft) or something).
Jun 12 2014
On Wednesday, 11 June 2014 at 22:20:27 UTC, Walter Bright wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?No, but if I had a 3rd party .lib that had been built on Windows and it was the only known source for that library, I would prefer to be able to convert it to a .a and link against it using extern(Windows) (if possible). I would vote that extern(Windows) should do what it says on the tin OR issue an error telling people that a Mac/Linux build of the compiler can't build binaries that have any chance of being compatible with any library they'll ever find or make, so not to include it as a build target.
Jun 11 2014
On Wed, 11 Jun 2014 15:20:29 -0700 Walter Bright via Digitalmars-d <digitalmars-d puremagic.com> wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?Regardless of what extern(Windows) is supposed to do on Windows systems, it seems _very_ broken to me to have it even compile on non-Windows systems. If you want it to work across OSes, that's what extern(System) is for. - Jonathan M Davis
Jun 11 2014
On Wednesday, 11 June 2014 at 22:20:27 UTC, Walter Bright wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?Isn't this the whole point of extern(System)? I don't really see the benefit, and don't think that extern(Windows) should even compile on non-Windows platforms.
Jun 11 2014
On Wednesday, 11 June 2014 at 22:20:27 UTC, Walter Bright wrote:I've got an enhancement request to have it behave like extern(C): https://issues.dlang.org/show_bug.cgi?id=12894 Thoughts? Anyone use extern(Windows) on non-Windows systems?That example of "I want this calling convention on platform X and that other convention on platform Y" points to the deeper problem that (without a preprocessor) you can't do something like this in D: version(Windows) alias extern(Foo) = extern(Windows); else alias extern(Foo) = extern(C); extern(Foo): void foobar(); int baz(); That reasoning also applies to various other attributes. IMO, repeating all of the declarations for the multiple variants you might want is not the right answer (DRY principle, etc.).
Jun 12 2014