With ffi-inliner you can run C code within your ruby script.
Andrea Fazzi
gem "ffi-inliner", "~> 0.2.4"