Try the ffi trick to nicely integrate C calls