Subject:
[ruby-ffi] What is the context parameter when defining a custom type with DataConverter?
From:
Kim Burgestrand
Date:
6/3/12 4:35 PM
To:
ruby-ffi@googlegroups.com

Looking at an old issue (https://github.com/ffi/ffi/issues/114#issuecomment-1246483) where a custom Bool type is defined, .to_native and .from_native both accept a second “ctx” parameter. What is this? How should it be used, if at all?

The reason I ask is that I’ve written my own converter for making sure input and output strings are always in UTF-8 encoding, and I’d like to do it properly: https://github.com/Burgestrand/libspotify-ruby/blob/35c32461d757649297e3592b80b4937e35e3a1f8/lib/spotify/utf8_string.rb