`FFI::TypeDefs` will missing some types if require `ffi` after monkey patch
jjyr opened this issue · 0 comments
jjyr commented
On my macbook:
require 'ffi' then monkey patch:
=> {:void=>#<FFI::Type::Builtin:VOID size=1 alignment=1>, :bool=>#<FFI::Type::Builtin:BOOL size=1 alignment=1>, :string=>#<FFI::Type::Builtin:STRING size=8 alignment=8>, :char=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :uchar=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :short=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :ushort=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :int=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :uint=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :long=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :ulong=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :long_long=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :ulong_long=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :float=>#<FFI::Type::Builtin:FLOAT32 size=4 alignment=4>, :double=>#<FFI::Type::Builtin:FLOAT64 size=8 alignment=8>, :long_double=>#<FFI::Type::Builtin:LONGDOUBLE size=16 alignment=16>, :pointer=>#<FFI::Type::Builtin:POINTER size=8 alignment=8>, :int8=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :uint8=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :int16=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :uint16=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :int32=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :uint32=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :int64=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :uint64=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :buffer_in=>#<FFI::Type::Builtin:BUFFER_IN size=8 alignment=8>, :buffer_out=>#<FFI::Type::Builtin:BUFFER_OUT size=8 alignment=8>, :buffer_inout=>#<FFI::Type::Builtin:BUFFER_INOUT size=8 alignment=8>, :varargs=>#<FFI::Type::Builtin:VARARGS size=1 alignment=1>, FFI::StrPtrConverter=>#<FFI::Type::Mapped:0x007fdf7f6ba520 size=8 alignment=8>, :strptr=>#<FFI::Type::Mapped:0x007fdf7f6ba520 size=8 alignment=8>, :__int8_t=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :__uint8_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :__int16_t=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :__uint16_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :__int32_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__uint32_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__int64_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :__uint64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :__darwin_intptr_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :__darwin_natural_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_ct_rune_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_ptrdiff_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :__darwin_size_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :__darwin_wchar_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_rune_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_wint_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_clock_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :__darwin_socklen_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_ssize_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :__darwin_time_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :int8_t=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :int16_t=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :int32_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :int64_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :u_int8_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :u_int16_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :u_int32_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :u_int64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :register_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :intptr_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :uintptr_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :user_addr_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :user_size_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :user_ssize_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :user_long_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :user_ulong_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :user_time_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :user_off_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :syscall_arg_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :__darwin_blkcnt_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :__darwin_blksize_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_dev_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_fsblkcnt_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_fsfilcnt_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_gid_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_id_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_ino64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :__darwin_ino_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :__darwin_mach_port_name_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_mach_port_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_mode_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :__darwin_off_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :__darwin_pid_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_sigset_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_suseconds_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :__darwin_uid_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :__darwin_useconds_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :"__darwin_uuid_t[16]"=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :"__darwin_uuid_string_t[37]"=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :__darwin_pthread_key_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :u_char=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :u_short=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :u_int=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :u_long=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :u_quad_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :quad_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :qaddr_t=>#<FFI::Type::Builtin:POINTER size=8 alignment=8>, :caddr_t=>#<FFI::Type::Builtin:POINTER size=8 alignment=8>, :daddr_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :dev_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :fixpt_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :blkcnt_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :blksize_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :gid_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :in_addr_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :in_port_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :ino_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :ino64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :key_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :mode_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :nlink_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :id_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :pid_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :off_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :segsz_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :swblk_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :uid_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :clock_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :size_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :ssize_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :time_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :useconds_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :suseconds_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :rsize_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :errno_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :fd_mask=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :pthread_key_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :fsblkcnt_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :fsfilcnt_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :sa_family_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :socklen_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :uint8_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :uint16_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :uint32_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :uint64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :int_least8_t=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :int_least16_t=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :int_least32_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :int_least64_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :uint_least8_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :uint_least16_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :uint_least32_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :uint_least64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :int_fast8_t=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :int_fast16_t=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :int_fast32_t=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :int_fast64_t=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :uint_fast8_t=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :uint_fast16_t=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :uint_fast32_t=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :uint_fast64_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :intmax_t=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :uintmax_t=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :rlim_t=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>}
require 'ffi' after monkey patch(missing some types):
=> {:void=>#<FFI::Type::Builtin:VOID size=1 alignment=1>, :bool=>#<FFI::Type::Builtin:BOOL size=1 alignment=1>, :string=>#<FFI::Type::Builtin:STRING size=8 alignment=8>, :char=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :uchar=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :short=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :ushort=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :int=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :uint=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :long=>#<FFI::Type::Builtin:LONG size=8 alignment=8>, :ulong=>#<FFI::Type::Builtin:ULONG size=8 alignment=8>, :long_long=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :ulong_long=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :float=>#<FFI::Type::Builtin:FLOAT32 size=4 alignment=4>, :double=>#<FFI::Type::Builtin:FLOAT64 size=8 alignment=8>, :long_double=>#<FFI::Type::Builtin:LONGDOUBLE size=16 alignment=16>, :pointer=>#<FFI::Type::Builtin:POINTER size=8 alignment=8>, :int8=>#<FFI::Type::Builtin:INT8 size=1 alignment=1>, :uint8=>#<FFI::Type::Builtin:UINT8 size=1 alignment=1>, :int16=>#<FFI::Type::Builtin:INT16 size=2 alignment=2>, :uint16=>#<FFI::Type::Builtin:UINT16 size=2 alignment=2>, :int32=>#<FFI::Type::Builtin:INT32 size=4 alignment=4>, :uint32=>#<FFI::Type::Builtin:UINT32 size=4 alignment=4>, :int64=>#<FFI::Type::Builtin:INT64 size=8 alignment=8>, :uint64=>#<FFI::Type::Builtin:UINT64 size=8 alignment=8>, :buffer_in=>#<FFI::Type::Builtin:BUFFER_IN size=8 alignment=8>, :buffer_out=>#<FFI::Type::Builtin:BUFFER_OUT size=8 alignment=8>, :buffer_inout=>#<FFI::Type::Builtin:BUFFER_INOUT size=8 alignment=8>, :varargs=>#<FFI::Type::Builtin:VARARGS size=1 alignment=1>, FFI::StrPtrConverter=>#<FFI::Type::Mapped:0x007fa1158376f0 size=8 alignment=8>, :strptr=>#<FFI::Type::Mapped:0x007fa1158376f0 size=8 alignment=8>, :caddr_t=>#<FFI::Type::Builtin:POINTER size=8 alignment=8>}