Settings

Theme

Teaching old C code new tricks with Nim

peterme.net

22 points by kindaAnIdiot 2 years ago · 2 comments

Reader

monetus 2 years ago

This is a good example of cross language interop making sense, and of considering the vast array of old C libraries to be something worth remembering - and maybe putting in your toolkit. Wasm seems to cover a lot of this use case too, and any language with a good enough FFI. Interop is a priority for nim, though, and is pretty delightful to put to the test.

  • PMunch 2 years ago

    Indeed, the FFI in Nim is really great, and with ARC it's so much easier to properly integrate with the malloc/free lifecycle that most C libraries use. The full wrapper for this project is here: https://github.com/PMunch/mapm-nim and I've already converted a calculator program of mine to using this instead of floats by simply just swapping out the type. Checked with Valgrind and besides finding some bugs in another external library it was happy.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection