1require 'fiddle.so' 2require 'fiddle/function' 3require 'fiddle/closure' 4 5module Fiddle 6 if WINDOWS 7 # Returns the last win32 +Error+ of the current executing +Thread+ or nil 8 # if none 9 def self.win32_last_error 10 Thread.current[:__FIDDLE_WIN32_LAST_ERROR__] 11 end 12 13 # Sets the last win32 +Error+ of the current executing +Thread+ to +error+ 14 def self.win32_last_error= error 15 Thread.current[:__FIDDLE_WIN32_LAST_ERROR__] = error 16 end 17 end 18 19 # Returns the last +Error+ of the current executing +Thread+ or nil if none 20 def self.last_error 21 Thread.current[:__FIDDLE_LAST_ERROR__] 22 end 23 24 # Sets the last +Error+ of the current executing +Thread+ to +error+ 25 def self.last_error= error 26 Thread.current[:__DL2_LAST_ERROR__] = error 27 Thread.current[:__FIDDLE_LAST_ERROR__] = error 28 end 29 30 # call-seq: dlopen(library) => Fiddle::Handle 31 # 32 # Creates a new handler that opens +library+, and returns an instance of 33 # Fiddle::Handle. 34 # 35 # See Fiddle::Handle.new for more. 36 def dlopen library 37 Fiddle::Handle.new library 38 end 39 module_function :dlopen 40 41 # Add constants for backwards compat 42 43 RTLD_GLOBAL = Handle::RTLD_GLOBAL # :nodoc: 44 RTLD_LAZY = Handle::RTLD_LAZY # :nodoc: 45 RTLD_NOW = Handle::RTLD_NOW # :nodoc: 46end 47