Flowdock
module

DL

Importance_2
Ruby latest stable (v2_5_5) - 0 notes

Module deprecated or moved

This module is deprecated or moved on the latest stable version. The last existing version (v2_1_10) is shown here.

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! :-)

Constants

StdcallCallbackAddrs = {}

StdcallCallbackProcs = {}

CdeclCallbackAddrs = {}

CdeclCallbackProcs = {}

SEM = Mutex.new # :nodoc:

BUILD_RUBY_VERSION = Document-const

BUILD_RUBY_PLATFORM = Document-const

RUBY_FREE = Document-const

SIZEOF_UINTPTR_T = Document-const

SIZEOF_INTPTR_T = Document-const

SIZEOF_PTRDIFF_T = Document-const

SIZEOF_SSIZE_T = Document-const

SIZEOF_SIZE_T = Document-const

SIZEOF_DOUBLE = Document-const

SIZEOF_FLOAT = Document-const

SIZEOF_LONG_LONG = Document-const

SIZEOF_LONG = Document-const

SIZEOF_INT = Document-const

SIZEOF_SHORT = Document-const

SIZEOF_CHAR = Document-const

SIZEOF_VOIDP = Document-const

ALIGN_UINTPTR_T = Document-const

ALIGN_INTPTR_T = Document-const

ALIGN_PTRDIFF_T = Document-const

ALIGN_SSIZE_T = Document-const

ALIGN_SIZE_T = Document-const

ALIGN_DOUBLE = Document-const

ALIGN_FLOAT = Document-const

ALIGN_LONG_LONG = Document-const

ALIGN_LONG = Document-const

ALIGN_INT = Document-const

ALIGN_SHORT = Document-const

ALIGN_CHAR = Document-const

ALIGN_VOIDP = Document-const

TYPE_UINTPTR_T = Document-const: TYPE_UINTPTR_T DL:

TYPE_INTPTR_T = Document-const: TYPE_INTPTR_T DL:

TYPE_PTRDIFF_T = Document-const: TYPE_PTRDIFF_T DL:

TYPE_SSIZE_T = Document-const: TYPE_SSIZE_T DL:

TYPE_SIZE_T = Document-const: TYPE_SIZE_T DL:

TYPE_DOUBLE = Document-const: TYPE_DOUBLE DL:

TYPE_FLOAT = Document-const: TYPE_FLOAT DL:

TYPE_LONG_LONG = Document-const: TYPE_LONG_LONG DL:

TYPE_LONG = Document-const: TYPE_LONG DL:

TYPE_INT = Document-const: TYPE_INT DL:

TYPE_SHORT = Document-const: TYPE_SHORT DL:

TYPE_CHAR = Document-const: TYPE_CHAR DL:

TYPE_VOIDP = Document-const: TYPE_VOIDP DL:

TYPE_VOID = Document-const: TYPE_VOID DL:

RTLD_NOW = Document-const: RTLD_NOW rtld DL:

RTLD_LAZY = Document-const: RTLD_LAZY rtld DL:

RTLD_GLOBAL = Document-const: RTLD_GLOBAL rtld DL:

DLSTACK_SIZE = Document-const

MAX_CALLBACK = Document-const

Attributes

Show files where this module is defined (11 files)
Register or log in to add new notes.