module Fiddle::FFIBackend
Constants
- FFITypes
Public Class Methods
Source
# File ext/fiddle/lib/fiddle/ffi_backend.rb, line 107
def self.to_ffi_type(fiddle_type)
if fiddle_type.is_a?(Symbol)
fiddle_type = Types.const_get(fiddle_type.to_s.upcase)
end
if !fiddle_type.is_a?(Integer) && fiddle_type.respond_to?(:to_int)
fiddle_type = fiddle_type.to_int
end
ffi_type = FFITypes[fiddle_type]
ffi_type = FFITypes[-fiddle_type] if ffi_type.nil? && fiddle_type.is_a?(Integer) && fiddle_type < 0
raise TypeError.new("cannot convert #{fiddle_type} to ffi") unless ffi_type
ffi_type
end
Ruby Core © 1993–2024 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.