Method: Fiddle.dlwrap

Defined in:
fiddle.c,
lib/fiddle/ffi_backend.rb

.dlwrap(val) ⇒ Object

Returns the memory address of the Ruby object stored at val

Example:

x = Object.new
# => #<Object:0x0000000107c7d870>
Fiddle.dlwrap(x)
# => 4425504880

In the case val is not a heap allocated object, this method will return the tagged pointer value.

Example:

Fiddle.dlwrap(123)
# => 247


100
101
102
# File 'fiddle.c', line 100

def self.dlwrap(val)
  Pointer.to_ptr(val)
end