Class: FFI::Struct::ManagedStructConverter

Inherits:
FFI::StructByReference show all
Defined in:
lib/ffi/struct.rb

Instance Method Summary (collapse)

Methods inherited from FFI::StructByReference

#native_type, #struct_class, #to_native

Constructor Details

- (ManagedStructConverter) initialize(struct_class)

A new instance of ManagedStructConverter

Raises:

  • (NoMethodError)


165
166
167
168
169
170
# File 'lib/ffi/struct.rb', line 165

def initialize(struct_class)
  super(struct_class)

  raise NoMethodError, "release() not implemented for class #{struct_class}" unless struct_class.respond_to? :release
  @method = struct_class.method(:release)
end

Instance Method Details

- (Object) from_native(ptr, ctx)



172
173
174
# File 'lib/ffi/struct.rb', line 172

def from_native(ptr, ctx)
  struct_class.new(AutoPointer.new(ptr, @method))
end