There is a lot of tooling written in go in the container image space and I’m trying to figure out how best to leverage it. One possibility may be to use the ffi[1] gem to create ruby bindings. Has anyone used this or know of pros/cons?
I maintain a small native gem called newt, it does not use ffi:
I wrote also ruby-pcptrace bindings which are really tiny:
I started as a ffi wrapper but since the API was so small, native code was actually less lines than ffi:
One major drawback of ffi is performance, which is worse. Also keep in mind than ffi introduces a “common layer” so it is not very powerful and there are limitations you might hit. I kinda struggled with understanding ffi so I went ahead and wrote the C part it was actually easier to learn for me.
Now for cross-languages ffi might be a good choice, but what I want to say is do not throw away the idea of plain native Ruby extension from the very beginning. And good luck with maintaining that code