class Novika::Library

Overview

A library is a collection of foreign functions.

A library form can be opened with a block of function declarations to be exposed. Each function declaration consists of the function's name and type signature. Exposed functions are then defined in the opener block.

For more details, see Novika's ffi:getLibrary.

Internally, library objects are created by the frontend and fed to the capability collection caps. When needed, they are retrieved from this capability collection.

Included Modules

Defined in:

novika/forms/foreign.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Novika::Schedulable::ShouldOpenWhenScheduled

schedule!(engine : Engine, stack : Block) schedule!

Instance methods inherited from module Novika::Form

a(type : T.class) : T forall T a, desc(io : IO)
desc : String
desc
, die(details : String) die, effect(io)
effect
effect
, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote

Instance methods inherited from module Novika::Schedulable

schedule(engine : Engine, stack : Block) schedule, schedule!(engine : Engine, stack : Block) schedule!

Constructor Detail

def self.new(id : String, path : Path) : Library #

Initializes a library for the dynamic library at path, with the given identifier (may be chosen arbitrarily).

May die if LibDL fails to load the library.


Class Method Detail

def self.new?(id : String, cwd : Path, env : Resolver::RunnableEnvironment) : Library | Nil #

Tries to find the library with the given id in the system- specific library directories, current working directory cwd, and in the runnable environment env.

Returns nil if the library could not be found or loaded.


def self.new?(id : String, path : Path) : Library | Nil #

Initializes a library for the dynamic library at path, with the given identifier (it may be chosen arbitrarily).

Returns nil if the library could not be loaded.


def self.typedesc #

Instance Method Detail

def desc(io) #

def finalize #

def id : String #

Returns the identifier of this library.


def on_open(engine : Engine) : self #
Description copied from module Novika::Form

Reacts to this form being opened with engine.


def to_s(io) #