Module: LibZMQ::PollItemLayout

Included in:
PollItem
Defined in:
lib/ffi-rzmq-core/structures.rb

Overview

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

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 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