Skip to content

Instantly share code, notes, and snippets.

@fenrir-naru
Created July 13, 2025 15:58
Show Gist options
  • Save fenrir-naru/22fea70438da83bec92f7468bc5a4a67 to your computer and use it in GitHub Desktop.
Save fenrir-naru/22fea70438da83bec92f7468bc5a4a67 to your computer and use it in GitHub Desktop.
Access Ractor::Selector by calling C API without Ruby build
if true then
# Fiddle version
require 'fiddle'
module Fiddle
Function.new(dlopen(nil).sym('rb_init_ractor_selector'), [], TYPE_VOID).call
end
else
# FFI version
require 'ffi'
Module::new{
extend FFI::Library
ffi_lib FFI::CURRENT_PROCESS
attach_function :rb_init_ractor_selector, [], :void
}::rb_init_ractor_selector
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment