Module: HyperCast::Runtime

Defined in:
lib/hypercast/runtime.rb

Overview

Fiddle plumbing for the native libhypercast shared library — dlopen/dlsym plus raw C-ABI calls, no runtime bridge. Fiddle ships with every Ruby install; it's a plain gem dependency here rather than a third-party one. A Ruby gem's files are already plain files on disk once installed, so native/rid/lib dlopen's directly — no extraction.

Constant Summary collapse

NATIVE_DIR =
File.join(__dir__, "native")
PLAIN =
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_SIZE_T, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP].freeze
NUMERIC =
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_SIZE_T, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP,
Fiddle::TYPE_VOIDP].freeze
UNIX =
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_SIZE_T, Fiddle::TYPE_UINT32_T, Fiddle::TYPE_VOIDP,
Fiddle::TYPE_VOIDP].freeze
DOORS =
{
  cast_bool: PLAIN,
  cast_i8: NUMERIC, cast_i16: NUMERIC, cast_i32: NUMERIC, cast_i64: NUMERIC,
  cast_u8: NUMERIC, cast_u16: NUMERIC, cast_u32: NUMERIC, cast_u64: NUMERIC,
  cast_f32: NUMERIC, cast_f64: NUMERIC,
  cast_uuid: PLAIN,
  cast_timestamp: PLAIN, cast_unix: UNIX, cast_excel_serial: UNIX,
  cast_date: PLAIN, cast_date_ordered: UNIX, cast_datetime: UNIX,
  cast_time: PLAIN, cast_duration: PLAIN
}.freeze

Class Method Summary collapse

Class Method Details

.call(symbol, *args) ⇒ Object



32
33
34
# File 'lib/hypercast/runtime.rb', line 32

def call(symbol, *args)
  functions.fetch(symbol).call(*args)
end