Sha256: f4c9e3fceb521d653fa24cc090b2113c77dd043c1c7bab456a1872c1dd707d6d

Contents?: true

Size: 585 Bytes

Versions: 17

Compression:

Stored size: 585 Bytes

Contents

module WebP
  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

17 entries across 17 versions & 1 rubygems

Version Path
webp-ffi-0.4.0 lib/webp/libc.rb
webp-ffi-0.3.1 lib/webp/libc.rb
webp-ffi-0.3.0 lib/webp/libc.rb
webp-ffi-0.2.7 lib/webp/libc.rb
webp-ffi-0.2.6 lib/webp/libc.rb
webp-ffi-0.2.5 lib/webp/libc.rb
webp-ffi-0.2.4 lib/webp/libc.rb
webp-ffi-0.2.3 lib/webp/libc.rb
webp-ffi-0.2.2 lib/webp/libc.rb
webp-ffi-0.2.1 lib/webp/libc.rb
webp-ffi-0.2.0 lib/webp/libc.rb
webp-ffi-0.1.8 lib/webp/libc.rb
webp-ffi-0.1.7 lib/webp/libc.rb
webp-ffi-0.1.6 lib/webp/libc.rb
webp-ffi-0.1.5 lib/webp/libc.rb
webp-ffi-0.1.4 lib/webp/libc.rb
webp-ffi-0.1.3 lib/webp/libc.rb