typedef const void *atom_ref_t
typedef const void *AtomString
typedef double avm_float_t
typedef int64_t avm_int64_t
typedef intptr_t avm_int_t
typedef uint64_t avm_uint64_t
typedef uintptr_t avm_uint_t
typedef void *(*avmpack_fold_fun)(void *accum, const void *section_ptr, uint32_t section_size, const void *beam_ptr, uint32_t flags, const char *section_name)

callback function for AVMPack section fold.

Instances of this function are supplied to the avmpack_fold function, in order to provide a callback mechanism for folding over the contents of the AVM binary.

Param accum:

The accumulator supplied by the application.

Param section_ptr:

a pointer to the start of the AVM section (including the module header).

Param section_size:

the size of the entire section (including the module header).

Param beam_ptr:

the start of the beam module portion of the section. This pointers starts immediately after the (aligned) header.

Param flags:

the section flags, as defined in the module header.

Param section_name:

the section name, as defined in the module header.


an accumulator, which will be supplied to the next call to this function, and eventually returned from the avmpack_fold function.

typedef term ERL_NIF_TERM

A term.

typedef int ErlNifEvent

Selectable event.

typedef uint64_t ErlNifMonitor

Opaque monitor type.

typedef int32_t ErlNifPid

a pid

We currently only handle local pids.

typedef void ErlNifResourceDown(ErlNifEnv *caller_env, void *obj, ErlNifPid *pid, ErlNifMonitor *mon)

Resource monitor callback.

typedef void ErlNifResourceDtor(ErlNifEnv *caller_env, void *obj)

Destructor callback.

typedef void ErlNifResourceStop(ErlNifEnv *caller_env, void *obj, ErlNifEvent event, int is_direct_call)

Select stop callback.

typedef struct ResourceType ErlNifResourceType

Opaque resource type.

typedef EventListener *(*event_handler_t)(GlobalContext *glb, EventListener *listener)

Event handlers (for ports)

The event handler is called from the scheduler thread but outside any process. It can send messages to processes using globalcontext_send_message function.

Result of this callback alters the list of handlers which is locked for writing when it is called. It can:

  • return listener, in which case the list is not modified

  • return NULL, in which case the entry is removed. The callback is responsible for freeing the listener.

  • return another listener, in which case the current listener is replaced by the other listener. The callback is responsible for freeing the previous listener if it is no longer needed.

Appending a listener is also possible by altering the list head.

This callback is defined for platforms using listeners.h header and can be ignored by others.

Param glb:

global context

Param listener:

the current listener


NULL if the current listener should be removed, listener if it should be kept or another listener if it should be replaced.

typedef struct EventListener EventListener

Event listener.

An event listener structure should be defined by the platform. Event listeners belong to the GlobalContext.listeners synchronized list.

typedef uintptr_t term

A value of any data type, types bigger than a machine word will require some additional space on heap.