Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Fiddle.dlwrap
Fiddle.dlwrap(val)
ext/fiddle/fiddle.c
View on GitHub ↗
static VALUE
rb_fiddle_value2ptr(VALUE self, VALUE val)
{
return PTR2NUM((void*)val);
}
Returns the memory address of the Ruby object stored at val
Example:
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:
Example
Fiddle.dlwrap(123) # => 247