2010-05-06 02:59:24 -04:00
|
|
|
require 'fiddle.so'
|
|
|
|
require 'fiddle/function'
|
|
|
|
require 'fiddle/closure'
|
2010-05-08 13:59:46 -04:00
|
|
|
require 'dl' unless Object.const_defined?(:DL)
|
2010-05-06 02:59:24 -04:00
|
|
|
|
|
|
|
module Fiddle
|
2011-08-15 19:48:59 -04:00
|
|
|
|
|
|
|
# A reference to DL::CPtr
|
2010-05-06 02:59:24 -04:00
|
|
|
Pointer = DL::CPtr
|
|
|
|
|
|
|
|
if WINDOWS
|
2011-08-15 19:48:59 -04:00
|
|
|
# Returns the last win32 +Error+ of the current executing +Thread+ or nil
|
|
|
|
# if none
|
2010-05-06 02:59:24 -04:00
|
|
|
def self.win32_last_error
|
|
|
|
Thread.current[:__FIDDLE_WIN32_LAST_ERROR__]
|
|
|
|
end
|
|
|
|
|
2011-08-15 19:48:59 -04:00
|
|
|
# Sets the last win32 +Error+ of the current executing +Thread+ to +error+
|
2010-05-06 02:59:24 -04:00
|
|
|
def self.win32_last_error= error
|
|
|
|
Thread.current[:__FIDDLE_WIN32_LAST_ERROR__] = error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-08-15 19:48:59 -04:00
|
|
|
# Returns the last +Error+ of the current executing +Thread+ or nil if none
|
2010-05-06 02:59:24 -04:00
|
|
|
def self.last_error
|
|
|
|
Thread.current[:__FIDDLE_LAST_ERROR__]
|
|
|
|
end
|
|
|
|
|
2011-08-15 19:48:59 -04:00
|
|
|
# Sets the last +Error+ of the current executing +Thread+ to +error+
|
2010-05-06 02:59:24 -04:00
|
|
|
def self.last_error= error
|
|
|
|
Thread.current[:__DL2_LAST_ERROR__] = error
|
|
|
|
Thread.current[:__FIDDLE_LAST_ERROR__] = error
|
|
|
|
end
|
|
|
|
end
|