lib/ffi/libc/libc.rb in ffi-libc-0.1.0 vs lib/ffi/libc/libc.rb in ffi-libc-0.1.1
- old
+ new
@@ -8,17 +8,20 @@
module FFI
module LibC
extend FFI::Library
- ffi_lib [FFI::CURRENT_PROCESS, 'c']
+ ffi_lib FFI::Library::LIBC
# The NULL constant
NULL = nil
# errno.h
- attach_variable :sys_errlist, :pointer
- attach_variable :sys_nerr, :int
+ begin
+ attach_variable :sys_errlist, :pointer
+ attach_variable :sys_nerr, :int
+ rescue FFI::NotFoundError
+ end
attach_variable :errno, :int
def self.raise_error(error=self.errno)
raise(strerror(error))
end