class Rubellite::Spinel::Kernel

Overview

Multi-function native C kernel container

Defined in:

rubellite/spinel.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, lib_path : String, handle : Pointer(Void), source_code : String = "") #

[View source]

Instance Method Detail

def async(return_type : T.class, func_name : String, *args) : Future(T) forall T #

Asynchronously executes the C kernel function on a background fiber without blocking the caller


[View source]
def call(func_name : String, *args) : Int64 #

Calls an exported symbol dynamically, defaulting to Int64 return


[View source]
def call_as(return_type : T.class, func_name : String, *args) : T forall T #

Calls an exported symbol with explicit return type


[View source]
def call_with_callback(func_name : String, *args, &block : Int64, Int64 -> Nil) : Nil #

Calls a C function passing a Crystal callback closure and its context


[View source]
def close #

[View source]
def disassemble(func_name : String | Nil = nil) : String #

Radare2 machine code disassembly inspection


[View source]
def export_to_ruby(ruby_class_or_mod : String, ruby_method_name : String, c_func_name : String, param_types : Array(String) = [] of String, return_type : String = "Int64") : Nil #

Exports a function from this kernel directly into embedded CRuby as a singleton method


[View source]
def function(func_name : String, return_type : String = "Int64") : NativeFunction #

Returns a callable NativeFunction handle for a specific exported symbol


[View source]
def handle : Pointer(Void) #

[View source]
def lib_path : String #

[View source]
def name : String #

[View source]
def pipe(input_channel : Channel(U), output_type : V.class, func_name : String, *args, capacity : Int32 = 64) : Channel(V) forall U, V #

Connects an input channel to a C processing kernel that streams to an output channel


[View source]
def source_code : String #

[View source]
def stream(item_type : T.class, func_name : String, *args, capacity : Int32 = 64) : Channel(T) forall T #

Streams real-time data from a C kernel into a Crystal Channel(T)


[View source]