# encoding: utf-8

module XS
  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; used for XS::Message deallocation
    Free = library.find_symbol('free')

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

# encoding: utf-8

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; used for XS::Message deallocation
  Free = library.find_symbol('free')

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

Revert "Wrap module LibC in XS"
Revert "Wrap module LibC in XS"

This reverts commit bddea962d3e17f4257a34ab02e3f9e80ee3697d8.
