Class | FFI::MemoryPointer |
In: |
lib/ffi/memorypointer.rb
lib/ffi/memorypointer.rb |
Parent: | Object |
def self.new(type, count=nil, clear=true)
size = if type.kind_of? Fixnum type elsif type.kind_of? Symbol FFI.type_size(type) else type.size end ptr = self.__allocate(size, count, clear) ptr.type_size = size if block_given? begin value = yield ptr ensure ptr.free end value else ptr end
end