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

Constant Summary

Constants inherited from Pointer

Pointer::NULL, Pointer::SIZE

Instance Method Summary (collapse)

Methods inherited from Pointer

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

Methods inherited from AbstractMemory

#[], #__copy_from__, #clear, #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_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, #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

- (nil) initialize_copy(other)

DO NOT CALL THIS METHOD



223
224
225
226
227
228
# File 'ext/ffi_c/DynamicLibrary.c', line 223

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

- (String) inspect

Inspect.



258
259
260
261
262
263
264
265
266
267
268
# File 'ext/ffi_c/DynamicLibrary.c', line 258

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

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