3 ms·
Nim wrapped around a good library can feel liberating. I feel like using it and FFIs is too uncommon.
by monetus 5y ago
Nim wrapped around a good library can feel liberating. I feel like using it and FFIs is too uncommon.
- girvo 5y agoI always get a bit sad when a nice library I come across in the wild is C++, as FFI to C++ is so much more... fiddly, in all languages, compared to a C library. The latter is a breeze. In fact, today, I needed to be able to call the `esp_pthreads.h` functions (which describe some ESP32-specific extensions to it's pthread layer) and it took me, no joke, 5 minutes to wrap. Pass the header through c2nim, add `{.importc, header: "esp_pthreads.h".}` pragmas to the proc definition, and done. Now I can call them without issue. Its liberating for sure! That said, you can even wrap C++ if need be, though it's less elegant at times.