Your suggestion for relying on the `importc`'ed type being well behaved did the trick. Thanks!
As for The Machinery, it seems like the founding team has earned a good reputation among other veteran game developers. I've hacked on the engine a little bit to make various modifications, and compared to Godot's C++ it's much easier to understand and modify. Also, I don't know of any other option to use Nim with a "AAA" game engine.