Top Inners Fields Constructors Methods
org.jruby.ext.ffi.jffi

public Class DynamicLibrary

extends RubyObject
Class Inheritance
Annotations
@JRubyClass
name:FFI::DynamicLibrary
parent:Object
Imports
com.kenai.jffi.Library, java.io.File, .IOException, .InputStream, java.nio.file.Files, .Path, .StandardCopyOption, java.util.HashMap, org.jruby.Ruby, .RubyClass, .RubyModule, .RubyNumeric, .RubyObject, org.jruby.anno.JRubyClass, .JRubyConstant, .JRubyMethod, org.jruby.api.Access, org.jruby.ext.ffi.InvalidMemoryIO, .MemoryIO, .Pointer, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.FileResource, .JRubyClassLoader, .JRubyFile

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DynamicLibrary.DataSymbolMemoryIO

Small MemoryIO wrapper class to keep the library alive

public static class
private static class
DynamicLibrary.TextSymbolMemoryIO

Since the text area of a dynamic library is usually not readable nor writable, wrap the address in a MemoryIO instance that throws an exception on all accesses

Field Summary

Modifier and TypeField and Description
private static HashMap<String, String>
private final Library
private final String
public static final int
public static final int
public static final int
public static final int
Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
public
DynamicLibrary(Ruby runtime, RubyClass klass, String name, Library library)

Method Summary

Modifier and TypeMethod and Description
public static RubyClass
private static synchronized String
extractLibrary(String name, InputStream resourceAsStream)

public IRubyObject
findFunction(ThreadContext context, IRubyObject symbolName)

public IRubyObject
findVariable(ThreadContext context, IRubyObject symbolName)

pack-priv final Library
private static final int
public IRubyObject
public static final IRubyObject
open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags)

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalequalsfinishObjectClassgetNativeClassIndexhashCodeinspectop_eqqputsspecificEvaltoRubyStringtoString

Field Detail

extractedLibrariesback to summary
private static HashMap<String, String> extractedLibraries
libraryback to summary
private final Library library
nameback to summary
private final String name
RTLD_GLOBALback to summary
public static final int RTLD_GLOBAL
Annotations
@JRubyConstant
RTLD_LAZYback to summary
public static final int RTLD_LAZY
Annotations
@JRubyConstant
RTLD_LOCALback to summary
public static final int RTLD_LOCAL
Annotations
@JRubyConstant
RTLD_NOWback to summary
public static final int RTLD_NOW
Annotations
@JRubyConstant

Constructor Detail

DynamicLibraryback to summary
public DynamicLibrary(Ruby runtime, RubyClass klass, String name, Library library)

Method Detail

createDynamicLibraryClassback to summary
public static RubyClass createDynamicLibraryClass(ThreadContext context, RubyModule FFI, RubyClass Object)
extractLibraryback to summary
private static synchronized String extractLibrary(String name, InputStream resourceAsStream) throws IOException
findFunctionback to summary
public IRubyObject findFunction(ThreadContext context, IRubyObject symbolName)
Annotations
@JRubyMethod
name:find_function
findVariableback to summary
public IRubyObject findVariable(ThreadContext context, IRubyObject symbolName)
Annotations
@JRubyMethod
name:find_variable, find_symbol
getNativeLibraryback to summary
pack-priv final Library getNativeLibrary()
getNativeLibraryFlagsback to summary
private static final int getNativeLibraryFlags(ThreadContext context, IRubyObject rbFlags)
nameback to summary
public IRubyObject name(ThreadContext context)
Annotations
@JRubyMethod
name:name
openback to summary
public static final IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags)
Annotations
@JRubyMethod
name:open
meta:true
org.jruby.ext.ffi.jffi back to summary

private final Class DynamicLibrary.DataSymbolMemoryIO

extends NativeMemoryIO
Class Inheritance

Small MemoryIO wrapper class to keep the library alive

Field Summary

Modifier and TypeField and Description
private final DynamicLibrary
Inherited from org.jruby.ext.ffi.jffi.NativeMemoryIO:
IOparent

Constructor Summary

AccessConstructor and Description
public
DataSymbolMemoryIO(Ruby runtime, DynamicLibrary library, long address)

Method Summary

Inherited from org.jruby.ext.ffi.jffi.NativeMemoryIO:
arrayarrayLengtharrayOffsetasByteBufferdupequalsgetgetgetgetgetgetgetAddressgetBytegetDoublegetFloatgetIntgetLonggetMemoryIOgetNativeLonggetShortgetZeroTerminatedByteArraygetZeroTerminatedByteArrayhashCodeindexOfindexOforderputputputputputputputAddressputByteputDoubleputFloatputIntputLongputMemoryIOputNativeLongputShortputZeroTerminatedByteArraysetMemorysliceslicewrap

Field Detail

libraryback to summary
private final DynamicLibrary library

Constructor Detail

DataSymbolMemoryIOback to summary
public DataSymbolMemoryIO(Ruby runtime, DynamicLibrary library, long address)
org.jruby.ext.ffi.jffi back to summary

public final Class DynamicLibrary.Symbol

extends Pointer
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final DynamicLibrary
private final String

Constructor Summary

AccessConstructor and Description
public
Symbol(Ruby runtime, DynamicLibrary library, String name, MemoryIO io)

Method Summary

Modifier and TypeMethod and Description
pack-priv final String
public IRubyObject
inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Returns a string containing a human-readable representation of obj.

public IRubyObject
public IRubyObject
public final String
toString()

Overrides org.jruby.RubyObject.toString.

The default toString method is just a wrapper that calls the Ruby "to_s" method.

Inherited from org.jruby.ext.ffi.Pointer:
addresscreatePointerClassgetAddressgetNullgetPointergetPointerClassinitializeinitializeinitialize_copynull_pop_equalordersizesliceslice

Field Detail

libraryback to summary
private final DynamicLibrary library
nameback to summary
private final String name

Constructor Detail

Symbolback to summary
public Symbol(Ruby runtime, DynamicLibrary library, String name, MemoryIO io)

Method Detail

getNameback to summary
pack-priv final String getName()
inspectback to summary
public IRubyObject inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Doc from org.jruby.RubyBasicObject.inspect.

Returns a string containing a human-readable representation of obj. If not overridden, uses the to_s method to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"

Annotations
@JRubyMethod
name:inspect
libraryback to summary
public IRubyObject library(ThreadContext context)
Annotations
@JRubyMethod
name:library
to_sback to summary
public IRubyObject to_s(ThreadContext context)

Overrides org.jruby.ext.ffi.Pointer.to_s.

Annotations
@JRubyMethod
name:to_s
toStringback to summary
public final String toString()

Overrides org.jruby.RubyObject.toString.

Doc from org.jruby.RubyObject.toString.

The default toString method is just a wrapper that calls the Ruby "to_s" method.

Returns:String

string representation

Annotations
@Override
org.jruby.ext.ffi.jffi back to summary

private final Class DynamicLibrary.TextSymbolMemoryIO

extends InvalidMemoryIO
Class Inheritance

Since the text area of a dynamic library is usually not readable nor writable, wrap the address in a MemoryIO instance that throws an exception on all accesses

Field Summary

Modifier and TypeField and Description
private final DynamicLibrary
Inherited from org.jruby.ext.ffi.InvalidMemoryIO:
runtime

Constructor Summary

AccessConstructor and Description
public
TextSymbolMemoryIO(Ruby runtime, DynamicLibrary library, long address)

Method Summary

Inherited from org.jruby.ext.ffi.InvalidMemoryIO:
arrayarrayLengtharrayOffsetasByteBuffercleardupexgetgetgetgetgetgetgetAddressgetBytegetDoublegetErrorClassgetFloatgetIntgetLonggetMemoryIOgetNativeLonggetShortgetZeroTerminatedByteArraygetZeroTerminatedByteArrayindexOfindexOforderputputputputputputputAddressputByteputDoubleputFloatputIntputLongputMemoryIOputNativeLongputShortputZeroTerminatedByteArraysetMemorysliceslice

Field Detail

libraryback to summary
private final DynamicLibrary library

Constructor Detail

TextSymbolMemoryIOback to summary
public TextSymbolMemoryIO(Ruby runtime, DynamicLibrary library, long address)