123456789_123456789_123456789_123456789_123456789_

Class: FFI::DynamicLibrary::Symbol

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: FFI::Pointer
Defined in: ext/ffi_c/DynamicLibrary.c

Overview

An instance of this class represents a library symbol. It may be a pointer to a function or to a variable.

Constant Summary

::FFI::AbstractMemory - Inherited

LONG_MAX

::FFI::Pointer - Inherited

NULL, SIZE

Class Method Summary

::FFI::Pointer - Inherited

.new

A new instance of ::FFI::Pointer.

.size

Return the size of a pointer on the current platform, in bytes.

Instance Attribute Summary

::FFI::Pointer - Inherited

::FFI::AbstractMemory - Inherited

#size_limit?

Return true if self has a size limit.

Instance Method Summary

::FFI::Pointer - Inherited

#+, #==,
#address

Alias for Pointer#to_i.

#free,
#initialize_copy

This method is internally used by #dup and #clone.

#inspect

Alias for Pointer#to_s.

#order

Get or set self‘s endianness.

#read

Read pointer’s contents as type

#read_array_of_type

Read an array of type of length length.

#read_string

Read pointer’s contents as a string, or the first len bytes of the equivalent string if len is not nil.

#read_string_length

Read the first len bytes of pointer’s contents as a string.

#read_string_to_null

Read pointer’s contents as a string.

#slice, #to_i, #to_ptr, #to_s, #type_size,
#write

Write value of type type to pointer’s content.

#write_array_of_type

Write ary in pointer’s contents as type.

#write_string

Write str in pointer’s contents, or first len bytes if len is not nil.

#write_string_length

Write len first bytes of str in pointer’s contents.

::FFI::AbstractMemory - Inherited

Constructor Details

This class inherits a constructor from FFI::Pointer

Instance Method Details

#initialize_copy(other) NOT(CALL)

[ GitHub ]

  
# File 'ext/ffi_c/DynamicLibrary.c', line 264

static VALUE
symbol_initialize_copy(VALUE self, VALUE other)
{
    rb_raise(rb_eRuntimeError, "cannot duplicate symbol");
    return Qnil;
}

#inspect Inspect

[ GitHub ]

  
# File 'ext/ffi_c/DynamicLibrary.c', line 315

static VALUE
symbol_inspect(VALUE self)
{
    LibrarySymbol* sym;
    char buf[256];

    TypedData_Get_Struct(self, LibrarySymbol, &library_symbol_data_type, sym);
    snprintf(buf, sizeof(buf), "#<FFI::DynamicLibrary::Symbol name=%s address=%p>",
             StringValueCStr(sym->name), sym->base.memory.address);
    return rb_str_new2(buf);
}