Ask HN: Modern C Libraries

13 points by kosolam ↗ HN
Starting a new project in C. A utility program that connects to a web service, parses json response, does some calculations and inserts into rocksdb. What libraries, frameworks would you recommend I use today in a new C project so that my developer experience is comfortable and I don’t need to develop standard functionality and rather rely on good libraries

9 comments

[ 5.6 ms ] story [ 36.1 ms ] thread
If you want a comfortable developer experience without having to "develop standard functionality," choose another language. C is the "now code the rest of the owl" of programming languages.

Otherwise: libcurl for the requests, json-c[0] for the JSON handling. SDL2[1] for window handling/events/other glue stuff if necessary. I don't know what rocksdb is but I assume it has its own C API library.

[0]https://github.com/json-c/json-c

[1]https://github.com/libsdl-org/SDL

Go the traditional route:

Use gawk with curl/json extensions.

Develop gawk C api for rockdb or dump to file & upload data file to rockdb.

Use emscript compiled gawk in tab in web browser for gui / platform independence.

C isn't really what I'd choose for such things, but if you insist I remember libcurl was quite easy to work with.
I’d definitely choose C for such things because I want to know how things actually work, instead of doing a “cargo install” and then proceeding to read an API doc for two days.
I sympathise with that. But C is a bit low level to do a lot of messing about with strings. I'd use JavaScript myself. Python is a decent, but slow choice as well. C# and Java are also serviceable, but they're not trendy any more. Even a bash shell script would be ok.

You'll be doing a lot of tedious, error prone work to do this in C.

There's an awesome C list of libraries and frameworks [1]. Pick one that suits your needs.

Time and again folks say such and such isn't suitable tool to do something. While some of those admonitions are true, if you're doing something to learn, feel free to ignore those and enjoy your learning. There're folks who learn assembly even today and learn a great deal of other things than assembly and have fun too.

As for C, it'd recommend most folks know the basics since many "modern" languages totally don't teach you those, and in fact hide the details from you that things feel like magic to you eventually if you keep using these high-level languages. This is okay as long as you can know the basics and map them back when needed.

[1]: https://github.com/oz123/awesome-c