\

Vali, a C library for Varlink

43 points - 10/10/2025

Source
  • sho_hn

    10/14/2025

    Here's a C++/Qt one by KDE hacker David Edmundson: https://blog.davidedmundson.co.uk/blog/introducing-qtvarlink...

    • ongy

      10/14/2025

      Huh, that way of doing asynchronicity is quite interesting.

      Though my Haskell and Rust primed brain really dislikes the way ownership of the memory allocation for the response struct works.

      It gets allocated by the caller (library), handed over to the function fully owned, and then gets consumed by the response function?

      • andrewshadura

        10/14/2025

        I'm wondering why Varlink, while incredibly similar to JSON-RPC, is designed to be incompatible with it?

          • NewJazz

            10/14/2025

            Linux people don't want web folks messing with their plumbing is my take lol.

            More realistically, adding HTTP where it is not needed adds unnecessary complexity.

        • blixtra

          10/14/2025

          If you want to know more about Varlink, Lennart Poettering gave a talk about it at All Systems Go! last year. https://media.ccc.de/v/all-systems-go-2024-276-varlink-now-/...

          • NewJazz

            10/14/2025

            What does varlink do that grpc or capnproto don't offer? Hell, it doesn't even seem much batter than openapi...

              • emersion

                10/14/2025

                The main use-case is different: gRPC and Cap'n'Proto are designed for networked servers, while D-Bus and Varlink are designed for local IPC. Varlink is a lot simpler than other alternatives.

                  • sam_bristow

                    10/14/2025

                    I've only had a cursory look at Varlink, but it almost felt too simple. In particular the lack of unsigned or sized integers.

                    This might enf up being be fine, but it gave me pause when I looked at it previously.

                      • jauntywundrkind

                        10/16/2025

                        Varlink exists only to be extremely simple.

                        The Linux ecosystem was using D-Bus for basically everything. But there was some need for IPC in early boot, before any D-Bus brokers were started.

                        Varlink was the answer, as a simple direct (vs DBus's broker mediated) IPC.

                        • wolletd

                          10/14/2025

                          It's JSON with some simple idea of RPC added to it. With the main idea apparently being that it is human-readable.

                          We've been using Varlink for one project, but I've never found myself in a situation where I had any benefit from the data being JSON. You rarely read the raw data. But compared to gRPC or CapnProto, you lost compile-time type checking and now you need 10mins of testing a vending machine before you get a "key not found"-error because you missed one spot on renaming.

                          Also, I've written varlink-cpp building on asio and nl-json at some point: https://github.com/wolletd/varlink-cpp. But as our varlink usage declined, it never found much usage and isn't maintained.

                            • emersion

                              10/14/2025

                              "you lost compile-time type checking" makes it sound like you haven't been using code generation? Varlink has an interface definition language which makes everything type-safe.

                      • NewJazz

                        10/14/2025

                        Simpler is pretty subjective. A lot of people have already ingrained the complexity of grpc and/or capnproto. And more importantly, there are a lot of well maintained libraries for those protocols.

                        At the end of the day, local or remote, it is all just pushing data over sockets, no?

                • burstmode

                  10/14/2025

                  So, there's another copy of CORBA. :-)

                    • guerrilla

                      10/14/2025

                      That's intentional. That's where this began. GNOME started out by implementing CORBA in a library called ORBit. It was eventually replaced by D-Bus which got more widespread usage across desktop environments and components. Eventually that was adopted at the OS level because of systemd and now they're replacing that with this. So, literally yes.

                  • malkia

                    10/14/2025

                    json, rpc, and that uint64_t bit integer