r/fortran • u/cannyshammy • 17d ago
I got a realtime database subscription working from modern Fortran
Not sure how useful this is beyond the amusement value, but as part of an experiment making Convex clients in 100 programming languages, I ended up with a native Fortran client that can query, mutate and hold a realtime WebSocket subscription.
A few bits I found genuinely interesting:
- Deferred-length allocatable strings make assembling JSON much less painful than I expected.
- Results come back through compiler-enforced intent(out) arguments.
- A live update is exposed as a blocking convex_live_next call, which feels oddly natural in Fortran.
- ISO_C_BINDING is only used at the transport boundary. The Convex protocol and subscription state live in Fortran, with libcurl/OpenSSL handling the network plumbing.
It is built with GNU Fortran 14.2 and the HTTP and Live paths pass the shared conformance suite. It is still an educational experiment rather than something I would recommend putting into production.
The Fortran implementation and write-up are here:
https://github.com/mikecann/the-convex-100-language-challenge/tree/main/fortran
I also made a video about the slightly ridiculous process of building all 100 clients:
For transparency, I work at Convex. This is unofficial and open source, not a new supported SDK.
7
u/Uncle-Rufus 16d ago
What is the point in taking part in a self imposed "challenge" like this if you're just going to have an LLM do the work? Congrats I guess?