module LibZMQ::PollItemLayout

Create the basic mapping for the poll_item_t structure so we can access those fields via Ruby.

Public Class Methods

included(base) click to toggle source
# File lib/ffi-rzmq-core/structures.rb, line 54
def self.included(base)
  fd_type = if FFI::Platform::IS_WINDOWS && FFI::Platform::ADDRESS_SIZE == 64
    # On Windows, zmq.h defines fd as a SOCKET, which is 64 bits on x64.
    :uint64
  else
    :int
  end

  base.class_eval do
    layout :socket,  :pointer,
      :fd,    fd_type,
      :events, :short,
      :revents, :short
  end
end