arsd 10.3, dmd -target, druntime.dll

Posted 2021-09-27

dmd as a cross compiler in beta, ldc shared druntime improved, arsd 10.3 tagged.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

Community releases

The new dmd nightly has a -target command line option which takes an mtriple. Of course, dmd still only generates x86/x64 code, but this means it is now a bit easier to use it as a Windows x Linux cross compiler (though you could also do wine dmd like I do to build Windows exes from Linux, and WSL dmd to build Linux exes on a Windows computer, so not that new.)

The new LDC continues to advance the state-of-the-art shared druntime and phobos dlls which makes doing D language plugins to D language hosts easier. Very promising results in tests so far. gdc can do this too and has been able to for a long time if you build it yourself, but the ldc one is beating it to a formally packaged release. gdc too uses mingw conventions whereas ldc is more MSVC compatible so that is also nice.

dlls with dmd aren't too hard either, of course, but the non-shared druntime means there's several caveats you can hit in more complex use cases. I generally recommend you do COM style interop there, but with ldc's new support just about any random D code ought to work without surprises, with the exception of exported TLS variables which aren't that common anyway.

What Adam is working on

arsd 10.3 finally tagged - after a two month lull of bug fix only tags. Then I immediately tagged other bug fixes that weren't obvious until I tried to use it (gotta find an easier way to use it than to tag it!).

Among the new features are:

  • A grid layout in minigui. You manually set the positions and gravities and it makes things fit. The api here is somewhat awkward to use directly; the intention is to make a gui designer tool that does it visually in the future.
  • A table viewer in minigui. You tell it your data size then it asks you for the text to put in each cell.
  • More various gui bug fixes and usability enhancements, especially wrt scrolling on Windows.
  • OperatingSystemFont.getTtfBytes bridges that font loader to nanovega and opengl. I wrote about this a few weeks ago: http://dpldocs.info/this-week-in-d/Blog.Posted_2021_09_13.html#what-adam-is-working-on
  • Masking outbound data is now done in the websocket client per websocket spec. (Previously it always used a mask of zero whereas it is supposed to be randomized each send.)
  • http2.d now handles 100 Continue messages (even though compliant servers aren't supposed to send them unless you ask for them, and I wasn't asking for them! But non-compliant servers are common.)
  • new module arsd.qrcode for image generation of QR codes
  • simpledisplay's trueColorImageFromNativeHandle is now public and can be used to take full-screen shots.
    import arsd.simpledisplay;
    
    void main() {
        // take screenshot of the whole desktop
        auto image = trueColorImageFromNativeHandle(NativeWindowHandle.init);
        auto w = new SimpleWindow();
        // and display it inside the new window
        w.image = Image.fromMemoryImage(image);
        w.eventLoop(0);
    }

I'll write more about the minigui new stuff later, probably in a few weeks.