Type:
Module
Constants:
MAX_CALLBACK : Document-const

MAX_CALLBACK

Maximum number of callbacks

DLSTACK_SIZE : Document-const

DLSTACK_SIZE

Dynamic linker stack size

RTLD_GLOBAL : Document-const

RTLD_GLOBAL

rtld DL::Handle flag.

The symbols defined by this library will be made available for symbol resolution of subsequently loaded libraries.

RTLD_LAZY : Document-const

RTLD_LAZY

rtld DL::Handle flag.

Perform lazy binding. Only resolve symbols as the code that references them is executed. If the symbol is never referenced, then it is never resolved. (Lazy binding is only performed for function references; references to variables are always immediately bound when the library is loaded.)

RTLD_NOW : Document-const

RTLD_NOW

rtld DL::Handle flag.

If this value is specified or the environment variable LD_BIND_NOW is set to a nonempty string, all undefined symbols in the library are resolved before dlopen() returns. If this cannot be done an error is returned.

TYPE_VOID : Document-const

TYPE_VOID

DL::CFunc type - void

TYPE_VOIDP : Document-const

TYPE_VOIDP

DL::CFunc type - void*

TYPE_CHAR : Document-const

TYPE_CHAR

DL::CFunc type - char

TYPE_SHORT : Document-const

TYPE_SHORT

DL::CFunc type - short

TYPE_INT : Document-const

TYPE_INT

DL::CFunc type - int

TYPE_LONG : Document-const

TYPE_LONG

DL::CFunc type - long

TYPE_LONG_LONG : Document-const

TYPE_LONG_LONG

DL::CFunc type - long long

TYPE_FLOAT : Document-const

TYPE_FLOAT

DL::CFunc type - float

TYPE_DOUBLE : Document-const

TYPE_DOUBLE

DL::CFunc type - double

TYPE_SIZE_T : Document-const

TYPE_SIZE_T

DL::CFunc type - size_t

TYPE_SSIZE_T : Document-const

TYPE_SSIZE_T

DL::CFunc type - ssize_t

TYPE_PTRDIFF_T : Document-const

TYPE_PTRDIFF_T

DL::CFunc type - ptrdiff_t

TYPE_INTPTR_T : Document-const

TYPE_INTPTR_T

DL::CFunc type - intptr_t

TYPE_UINTPTR_T : Document-const

TYPE_UINTPTR_T

DL::CFunc type - uintptr_t

ALIGN_VOIDP : Document-const

ALIGN_VOIDP

The alignment size of a void*

ALIGN_CHAR : Document-const

ALIGN_CHAR

The alignment size of a char

ALIGN_SHORT : Document-const

ALIGN_SHORT

The alignment size of a short

ALIGN_INT : Document-const

ALIGN_INT

The alignment size of an int

ALIGN_LONG : Document-const

ALIGN_LONG

The alignment size of a long

ALIGN_LONG_LONG : Document-const

ALIGN_LONG_LONG

The alignment size of a long long

ALIGN_FLOAT : Document-const

ALIGN_FLOAT

The alignment size of a float

ALIGN_DOUBLE : Document-const

ALIGN_DOUBLE

The alignment size of a double

ALIGN_SIZE_T : Document-const

ALIGN_SIZE_T

The alignment size of a size_t

ALIGN_SSIZE_T : Document-const

ALIGN_SSIZE_T

The alignment size of a ssize_t

ALIGN_PTRDIFF_T : Document-const

ALIGN_PTRDIFF_T

The alignment size of a ptrdiff_t

ALIGN_INTPTR_T : Document-const

ALIGN_INTPTR_T

The alignment size of a intptr_t

ALIGN_UINTPTR_T : Document-const

ALIGN_UINTPTR_T

The alignment size of a uintptr_t

SIZEOF_VOIDP : Document-const

SIZEOF_VOIDP

size of a void*

SIZEOF_CHAR : Document-const

SIZEOF_CHAR

size of a char

SIZEOF_SHORT : Document-const

SIZEOF_SHORT

size of a short

SIZEOF_INT : Document-const

SIZEOF_INT

size of an int

SIZEOF_LONG : Document-const

SIZEOF_LONG

size of a long

SIZEOF_LONG_LONG : Document-const

SIZEOF_LONG_LONG

size of a long long

SIZEOF_FLOAT : Document-const

SIZEOF_FLOAT

size of a float

SIZEOF_DOUBLE : Document-const

SIZEOF_DOUBLE

size of a double

SIZEOF_SIZE_T : Document-const

SIZEOF_SIZE_T

size of a size_t

SIZEOF_SSIZE_T : Document-const

SIZEOF_SSIZE_T

size of a ssize_t

SIZEOF_PTRDIFF_T : Document-const

SIZEOF_PTRDIFF_T

size of a ptrdiff_t

SIZEOF_INTPTR_T : Document-const

SIZEOF_INTPTR_T

size of a intptr_t

SIZEOF_UINTPTR_T : Document-const

SIZEOF_UINTPTR_T

size of a uintptr_t

RUBY_FREE : Document-const

RUBY_FREE

Address of the ruby_xfree() function

BUILD_RUBY_PLATFORM : Document-const

BUILD_RUBY_PLATFORM

Platform built against (i.e. "x86_64-linux", etc.)

See also RUBY_PLATFORM

BUILD_RUBY_VERSION : Document-const

BUILD_RUBY_VERSION

Ruby Version built. (i.e. "1.9.3")

See also RUBY_VERSION

SEM : Mutex.new # :nodoc:

The mutual exclusion (Mutex) semaphore for the DL module

CdeclCallbackProcs : {}

A Hash of callback Procs

Uses Fiddle

CdeclCallbackAddrs : {}

A Hash of the addresses of callback Proc

Uses Fiddle

StdcallCallbackProcs : {}

A Hash of Stdcall callback Procs

Uses Fiddle on win32

StdcallCallbackAddrs : {}

A Hash of the addresses of Stdcall callback Procs

Uses Fiddle on win32

A bridge to the dlopen() or dynamic library linker function.

Example

bash $> cat > sum.c <<EOF
double sum(double *arry, int len)
{
        double ret = 0;
        int i;
        for(i = 0; i < len; i++){
                ret = ret + arry[i];
        }
        return ret;
}

double split(double num)
{
        double ret = 0;
        ret = num / 2;
        return ret;
}
EOF
bash $> gcc -o libsum.so -shared sum.c
bash $> cat > sum.rb <<EOF
require 'dl'
require 'dl/import'

module LibSum
        extend DL::Importer
        dlload './libsum.so'
        extern 'double sum(double*, int)'
        extern 'double split(double)'
end

a = [2.0, 3.0, 4.0]

sum = LibSum.sum(a.pack("d*"), a.count)
p LibSum.split(sum)
EOF
bash $> ruby sum.rb
4.5

WIN! :-)

dlunwrap

DL.dlunwrap(addr) Class Public methods Returns the hexadecimal representation

2015-04-03 22:42:32
remove_stdcall_callback

remove_stdcall_callback(addr, ctype = nil) Instance Public methods

2015-04-03 23:18:43
set_cdecl_callback

set_cdecl_callback(ty, argc, &cbp) Instance Public methods Also aliased

2015-04-03 23:30:45
free

DL.free(addr) Class Public methods Free the memory at address addr

2015-04-03 22:54:57
malloc

DL.malloc(size) Class Public methods Allocate size bytes of memory

2015-04-03 22:59:09
set_callback_internal

set_callback_internal(proc_entry, addr_entry, argc, ty, abi = nil, &cbp) Instance Public methods

2015-04-03 23:26:33
set_stdcall_callback

set_stdcall_callback(ty, argc, &cbp) Instance Public methods

2015-04-03 23:37:48
set_callback

set_callback(ty, argc, &cbp) Instance Public methods Alias for:

2015-04-03 23:23:36
remove_cdecl_callback

remove_cdecl_callback(addr, ctype = nil) Instance Public methods Also aliased

2015-04-03 23:14:43
dlwrap

DL.dlwrap(val) Class Public methods Returns a memory pointer of a function's

2015-04-03 22:46:46