Skip to content

Commit

Permalink
Add LibC definition lost when merging in dl. Fixes #3462.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed May 16, 2018
1 parent 6a1ee91 commit 482159b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ruby/stdlib/fiddle/jruby.rb
Expand Up @@ -164,6 +164,14 @@ def self.__freefunc__(free)
end
end

module LibC
extend FFI::Library
ffi_lib FFI::Library::LIBC
MALLOC = attach_function :malloc, [ :size_t ], :pointer
REALLOC = attach_function :realloc, [ :pointer, :size_t ], :pointer
FREE = attach_function :free, [ :pointer ], :void
end

def self.malloc(size, free = nil)
self.new(LibC.malloc(size), size, free ? free : LibC::FREE)
end
Expand Down

0 comments on commit 482159b

Please sign in to comment.