• 2 Posts
  • 11 Comments
Joined 6 years ago
cake
Cake day: May 31st, 2020

help-circle









  • Ah yeah, I guess, my interpretation of that quote wasn’t quite right.

    You can build a shared library in Rust, but it will need to be called via the C ABI or the WebAssembly ABI.
    It is also possible to call a C ABI library in Rust (and virtually any other language), as well as a WebAssembly ABI library.
    So, technically you can do shared libraries that way, but because the C ABI and WebAssembly ABI are significantly more limited compared to what you want to be passing around internally in Rust, you’ll only really want to use these in special cases.

    Rust doesn’t particularly like dynamic libs. It compiles libraries you use on your dev machine, so it knows how you’ll use the libraries, which allows it to make various assumptions and optimizations.
    For example, Rust can do generics via monomorphization (as opposed to vtables), which means it will generate the generic library code for each type that’s passed into the generic type argument. This is useful, because it can fully optimize that code, but also because it retains type information, despite the use of generics.


  • To my knowledge, they generally don’t. Shared libraries are a massive pain from a programming perspective, so it’s largely been avoided (even though there are some advantages for Linux distro maintainers and sysadmins).

    Modern languages usually bring along their own package manager, which downloads the libraries you want to use from a central repository and then bundles them into your build artifact that you hand to users.
    In ‘semi-modern’ languages, like the JVM languages and I think also Python, you get the dependencies in a folder as part of a larger archive.
    With Go and Rust, they decided to include those libraries directly into the executable, so that many programs can just ship a single executable.



  • What I always find fun is when open-source communities just continue developing games forever, defying this whole idea of old vs. new. NetHack is quite possibly the oldest example, which had its roots in Hack around 1982. And it’s still being actively developed, still getting new content. So, you get the retro gameplay and long history of the game, while also getting continuous updates like you’d get in an Early Access title. 🙃