Class: FFI::DynamicLibrary::Symbol

Inherits:
Pointer show all
Defined in:
ext/ffi_c/DynamicLibrary.c,
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

Constants inherited from Pointer

Pointer::NULL, Pointer::SIZE

Constants inherited from AbstractMemory

AbstractMemory::LONG_MAX

Instance Method Summary collapse

Methods inherited from Pointer

#+, #==, #address, #autorelease=, #autorelease?, #free, #initialize, #null?, #order, #read, #read_array_of_type, #read_string, #read_string_length, #read_string_to_null, size, #slice, #to_ptr, #to_s, #type_size, #write, #write_array_of_type, #write_string, #write_string_length

Methods inherited from AbstractMemory

#[], #__copy_from__, #clear, #freeze, #get, #get_array_of_float32, #get_array_of_float64, #get_array_of_pointer, #get_array_of_string, #get_bytes, #get_float32, #get_float64, #get_pointer, #get_string, #put, #put_array_of_float32, #put_array_of_float64, #put_array_of_pointer, #put_bytes, #put_float32, #put_float64, #put_pointer, #put_string, #read_array_of_double, #read_array_of_float, #read_array_of_pointer, #read_bytes, #read_double, #read_float, #read_pointer, #size_limit?, #total, #type_size, #write_array_of_double, #write_array_of_float, #write_array_of_pointer, #write_bytes, #write_double, #write_float, #write_pointer

Constructor Details

This class inherits a constructor from FFI::Pointer

Instance Method Details

#initialize_copy(other) ⇒ nil

DO NOT CALL THIS METHOD

Parameters:

  • other (Object)

Returns:

  • (nil)


264
265
266
267
268
269
# 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;
}

#inspectString

Inspect.

Returns:

  • (String)


315
316
317
318
319
320
321
322
323
324
325
# 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);
}