cffi (cffi v0.3.1)

View Source

Summary

Functions

align_of(Type)

-spec align_of(term()) -> pos_integer().

alloc(Bytes)

-spec alloc(pos_integer()) -> reference().

alloc_struct(StructName)

-spec alloc_struct(atom()) -> reference().

alloc_type(Type)

-spec alloc_type(term()) -> reference().

alloc_type(Type, Count)

-spec alloc_type(term(), pos_integer()) -> reference().

array_ptr(Ptr, ElemType, Index)

-spec array_ptr(reference(), term(), non_neg_integer()) -> reference().

array_read(Ptr, ElemType, Index)

-spec array_read(reference(), term(), non_neg_integer()) -> term().

array_write(Ptr, ElemType, Index, Value)

-spec array_write(reference(), term(), non_neg_integer(), term()) -> ok.

call(Lib, Func, RetType)

-spec call(reference(), string() | binary(), term()) -> {ok, term()} | {error, term()}.

call(Lib, Func, RetType, Args)

-spec call(reference(), string() | binary(), term(), list()) -> {ok, term()} | {error, term()}.

call_va(Lib, Func, RetType, NFixed, Args)

-spec call_va(reference(), string() | binary(), term(), pos_integer(), list()) ->
                 {ok, term()} | {error, term()}.

defcenum(Name, Values)

-spec defcenum(atom(), list()) -> ok.

defcstruct(Name, Fields)

-spec defcstruct(atom(), [{atom(), term()}]) -> ok.

defctype(Name, TypeSpec)

-spec defctype(atom(), term()) -> ok.

defcunion(Name, Fields)

-spec defcunion(atom(), [{atom(), term()}]) -> ok.

field_ptr(Ptr, TypeName, FieldName)

-spec field_ptr(reference(), atom(), atom()) -> reference().

free(Ptr)

-spec free(reference()) -> ok | {error, term()}.

is_null(Ptr)

-spec is_null(reference()) -> boolean().

load(Path)

-spec load(string() | binary()) -> {ok, reference()} | {error, term()}.

map_to_struct(Ptr, TypeName, Map)

-spec map_to_struct(reference(), atom(), map()) -> ok.

null()

-spec null() -> reference().

ptr_add(Ptr, Offset)

-spec ptr_add(reference(), integer()) -> reference().

read(Ptr, Type)

-spec read(reference(), term()) -> term().

read_bytes(Ptr, Size)

-spec read_bytes(reference(), pos_integer()) -> binary().

struct_read(Ptr, TypeName, FieldName)

-spec struct_read(reference(), atom(), atom()) -> term().

struct_to_map(Ptr, TypeName)

-spec struct_to_map(reference(), atom()) -> map().

struct_write(Ptr, TypeName, FieldName, Value)

-spec struct_write(reference(), atom(), atom(), term()) -> ok.

type_size(Type)

-spec type_size(term()) -> non_neg_integer().

with_alloc(Bytes, Fun)

-spec with_alloc(pos_integer(), fun((reference()) -> R)) -> R.

with_alloc(Type, Count, Fun)

-spec with_alloc(term(), pos_integer(), fun((reference()) -> R)) -> R.

write(Ptr, Type, Value)

-spec write(reference(), term(), term()) -> ok | {error, term()}.

write_bytes(Ptr, Bytes)

-spec write_bytes(reference(), binary()) -> ok.