Implement fix for ffi/ffi#239 from ruby-ffi