use more idiomatic way of getting a field from an object in ffi