I have an idea, though I'll honestly say that I don't know if it'll
work: try making some simpler C/C++ libraries, let SWIG do its thing
with those, and see what the code it produces looks like. It's
basically a template or a reference!

Then again, I don't work with Ruby extensions and C/C++ libraries
(though I intend to someday).

M.T.