module UNIX::Type

Public Instance Methods

sizeof(type) click to toggle source

Returns the size of a C-struct type. A replacement for C’s sizeof() function.

# File lib/unix/type.rb, line 8
def sizeof(type)
  size_ptr = Pointer.new(:ulong_long)
  align_ptr = Pointer.new(:ulong_long)
  NSGetSizeAndAlignment(type, size_ptr, align_ptr)
  size_ptr[0]
end