module Novika::FFI::ForeignType

Overview

Base type for Novika FFI types.

Direct including types

Defined in:

novika/ffi.cr

Instance Method Summary

Instance Method Detail

abstract def alloc : Pointer(Void) #

Allocates memory for this type. Returns a pointer to that memory.


[View source]
def from(form : Form) : ForeignValue #

Instantiates a foreign value of this foreign type from the given form.

Dies if conversion is impossible.


[View source]
def from?(form : Form) : ForeignValue | Nil #

Instantiates a foreign value of this foreign type from the given form.

Returns nil if conversion is impossible.


[View source]
def matches?(value : ForeignValue) : Bool #

Returns whether this type corresponds to the given value.


[View source]
def sizeof : UInt64 #

Returns the size of this type, in bytes.


[View source]
abstract def to_ffi_type : Crystal::FFI::Type #

Returns the corresponding LibFFI type.


[View source]
abstract def unbox(box : Pointer(Void)) : ForeignValue #

Retrieves ForeignValue of this type from the given void pointer box.


[View source]