digitalmars.D - Getting rid of global cdtors
- Andrei Alexandrescu (12/12) Jun 14 2020 Getting rid of static cdtors is a good goal for druntime and standard
- Adam D. Ruppe (8/11) Jun 14 2020 (I'm not certain about the rest of your post so just answering
- Avrina (4/7) Jun 14 2020 Probably best to test it on Windows, otherwise you are just
- Dukc (4/11) Jun 14 2020 Wine 5.0 works well for me at least. And I don't think testing on
- Mathias LANG (5/18) Jun 14 2020 Microsoft offers free images for developers. They have a lifespan
- Clarice (2/9) Jun 14 2020 That's neat!
- Andrei Alexandrescu (2/22) Jun 15 2020 Noted, thanks!
- Kagamin (2/4) Jun 15 2020
- Kagamin (10/10) Jun 15 2020 auto our_freeaddrinfo(A...)(A a) @system
- Andrei Alexandrescu (2/12) Jun 15 2020 What is the bug? Thanks.
- Andrei Alexandrescu (2/15) Jun 15 2020 Oh, I see. Forgot to negate!
- Andrei Alexandrescu (3/8) Jun 15 2020 Can you please mention this in the github thread? I'd be very glad to
- Andrei Alexandrescu (6/18) Jun 17 2020 I needed to close that PR and it would be great if someone could pick it...
- H. S. Teoh (8/14) Jun 17 2020 What about breaking it up into multiple PRs and get the non-breaking
- Andrei Alexandrescu (2/14) Jun 17 2020 I tried that and was told to do the Windows part too.
- H. S. Teoh (6/22) Jun 17 2020 What about use version(Windows) as a stop-gap measure for the time
- Timon Gehr (3/24) Jun 17 2020 What about this? https://dlang.org/library/object/object.factory.html
- Andrei Alexandrescu (2/27) Jun 17 2020 Yah, that'd need to be looked at too.
Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup. (BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)
Jun 14 2020
On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:(BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)(I'm not certain about the rest of your post so just answering this) I use wine dmd regularly without any trouble. It actually works even better now than it was supposed to since optlink used to have some kind of weird bug on wine and the lld linker is free from such pain!
Jun 14 2020
On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:(BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)Probably best to test it on Windows, otherwise you are just testing Wine's implementation and not actually your code.
Jun 14 2020
On Sunday, 14 June 2020 at 19:26:39 UTC, Avrina wrote:On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:Wine 5.0 works well for me at least. And I don't think testing on it is a problem, because the cloud autotester should catch the rare differences between Wine and Windows.(BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)Probably best to test it on Windows, otherwise you are just testing Wine's implementation and not actually your code.
Jun 14 2020
On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup. (BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)Microsoft offers free images for developers. They have a lifespan of 3 months IIRC, and come with Visual Studio / VSCode installed: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
Jun 14 2020
On Monday, 15 June 2020 at 02:37:20 UTC, Mathias LANG wrote:On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:That's neat![...]Microsoft offers free images for developers. They have a lifespan of 3 months IIRC, and come with Visual Studio / VSCode installed: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
Jun 14 2020
On 6/14/20 10:37 PM, Mathias LANG wrote:On Sunday, 14 June 2020 at 18:53:52 UTC, Andrei Alexandrescu wrote:Noted, thanks!Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup. (BTW, has wine support been maintained? It would be useful for such cases - I could test the Windows code without an installation.)Microsoft offers free images for developers. They have a lifespan of 3 months IIRC, and come with Visual Studio / VSCode installed: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
Jun 15 2020
Are all those indirections still needed? https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfoThe getaddrinfo function was added to the Ws2_32.dll on Windows XP and later.
Jun 15 2020
auto our_freeaddrinfo(A...)(A a) system { initialize; if (freeaddrinfoPointer) // May be null if WSAStartup() failed, just do nothing return; return freeaddrinfoPointer(a); } My, my, that's a subtle bug. Also winsock 2.2 is 0x0202, not 0x2020.
Jun 15 2020
On 6/15/20 6:25 AM, Kagamin wrote:auto our_freeaddrinfo(A...)(A a) system { initialize; if (freeaddrinfoPointer) // May be null if WSAStartup() failed, just do nothing return; return freeaddrinfoPointer(a); } My, my, that's a subtle bug.What is the bug? Thanks.
Jun 15 2020
On 6/15/20 2:37 PM, Andrei Alexandrescu wrote:On 6/15/20 6:25 AM, Kagamin wrote:Oh, I see. Forgot to negate!auto our_freeaddrinfo(A...)(A a) system { initialize; if (freeaddrinfoPointer) // May be null if WSAStartup() failed, just do nothing return; return freeaddrinfoPointer(a); } My, my, that's a subtle bug.What is the bug? Thanks.
Jun 15 2020
On 6/15/20 6:20 AM, Kagamin wrote:Are all those indirections still needed? https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf- s2tcpip-getaddrinfoCan you please mention this in the github thread? I'd be very glad to remove that stuff.The getaddrinfo function was added to the Ws2_32.dll on Windows XP and later.
Jun 15 2020
On 6/14/20 2:53 PM, Andrei Alexandrescu wrote:Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup.I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.
Jun 17 2020
On Wed, Jun 17, 2020 at 10:02:43PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...]I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.What about breaking it up into multiple PRs and get the non-breaking parts in first, while we wait for a Windows dev to step up to the plate? Some progress is better than none. T -- We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true. -- Robert Wilensk
Jun 17 2020
On 6/17/20 10:42 PM, H. S. Teoh wrote:On Wed, Jun 17, 2020 at 10:02:43PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...]I tried that and was told to do the Windows part too.I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.What about breaking it up into multiple PRs and get the non-breaking parts in first, while we wait for a Windows dev to step up to the plate? Some progress is better than none.
Jun 17 2020
On Wed, Jun 17, 2020 at 11:46:55PM -0400, Andrei Alexandrescu via Digitalmars-d wrote:On 6/17/20 10:42 PM, H. S. Teoh wrote:What about use version(Windows) as a stop-gap measure for the time being? T -- Never criticize a man until you've walked a mile in his shoes. Then when you do criticize him, you'll be a mile away and he won't have his shoes.On Wed, Jun 17, 2020 at 10:02:43PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...]I tried that and was told to do the Windows part too.I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.What about breaking it up into multiple PRs and get the non-breaking parts in first, while we wait for a Windows dev to step up to the plate? Some progress is better than none.
Jun 17 2020
On 18.06.20 04:02, Andrei Alexandrescu wrote:On 6/14/20 2:53 PM, Andrei Alexandrescu wrote:What about this? https://dlang.org/library/object/object.factory.html ProtoObject?Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup.I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.
Jun 17 2020
On 6/17/20 11:00 PM, Timon Gehr wrote:On 18.06.20 04:02, Andrei Alexandrescu wrote:Yah, that'd need to be looked at too.On 6/14/20 2:53 PM, Andrei Alexandrescu wrote:What about this? https://dlang.org/library/object/object.factory.html ProtoObject?Getting rid of static cdtors is a good goal for druntime and standard library. Modules that need initialization should do so lazily upon first use. I picked a low-hanging fruit in https://github.com/dlang/phobos/pull/7529 - there is no need at all to initialize and test pointers to function in Posix. Could a Windows engineer help with the Windows part? It's a bit more involved - the pointers to functions should be initialized upon first use in a Singleton manner, and atexit(WSACleanup) needs to be inserted right after the call to WSAStartup.I needed to close that PR and it would be great if someone could pick it up. I don't have the time to set up a Windows platform. Would be glad to take a look over the PR if someone would like to adopt it. As I noted in the PR, eliminating static cdtors is key to lean and mean executables on a pay-as-you-go basis.
Jun 17 2020