Sha256: 625b3697dc23effff4a1929a842716e655abbbecf399cba26e1e3668464ab20f

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

module WebpFfi
  module LibC
    extend FFI::Library
    # figures out the correct libc for each platform including Windows
    library = ffi_lib(FFI::Library::LIBC).first

    # Size_t not working properly on Windows
    find_type(:size_t) rescue typedef(:ulong, :size_t)

    # memory allocators
    attach_function :malloc, [:size_t], :pointer
    attach_function :free, [:pointer], :void
  
    # get a pointer to the free function
    Free = library.find_symbol('free')

    # memory movers
    attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
  end # module LibC
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webp-ffi-0.1.2 lib/webp_ffi/libc.rb
webp-ffi-0.1.1 lib/webp_ffi/libc.rb
webp-ffi-0.1.0 lib/webp_ffi/libc.rb