class FFI::MemoryPointer
Public Class Methods
from_array_of_strings(strings)
click to toggle source
after zegoggl.es/2009/05/ruby-ffi-recipes.html
# File lib/mpvlib/ffi_additions.rb, line 22 def self.from_array_of_strings(strings) string_ptrs = strings.map { |s| FFI::MemoryPointer.from_string(s) } + [nil] strings_ptr = new(:pointer, string_ptrs.length) string_ptrs.each_with_index do |ptr, i| strings_ptr[i].put_pointer(0, ptr) end strings_ptr end