4.10.10 nxm
Keywords: onyx

Next: 4.10.11 nxn Up: 4.10 Classes Previous: 4.10.9 nxa Contents Index
Subsections

- 4.10.10.1 API

##
4.10.10 nxm

The nxm class provides basic loadable module functionality.

### 4.10.10.1 API

cw_nxn_t nxm_new(cw_nxo_t *a_nxo, cw_nxo_t *a_path, cw_nxo_t *a_sym):

  Input(s):
    a_nxo:
      Pointer to space for a handle nxo.
    a_path:
      Pointer to a string nxo that specifies the path to a module.
    a_sym:
      Pointer to a string nxo that specifies a symbol in the module at a_path.
  Output(s):
    retval:
      NXN_ZERO:
        Success.
      NXN_invalidfileaccess:
        Unable to open a module at a_path.
      NXN_undefined:
        A symbol named a_sym was not found in the module.
    a_nxo:
      A handle nxo, with its evaluation function set to the specified symbol.
  Exception(s):
    CW_ONYXX_OOM.
  Description:
    Open the module at a_path, and create a handle with its evaluation function set to the symbol specified by a_sym. The module will remain loaded until the handle nxo is swept by the garbage collector.

uint32_t nxm_iter_get(cw_nxo_t *a_nxo):

  Input(s):
    a_nxo:
      Pointer to a handle nxo that was constructed by nxm_new().
  Output(s):
    retval:
      Garbage collector sweep iteration during which a_nxo will be deleted.
  Exception(s):
    None.
  Description:
    Get the garbage collector sweep iteration during which a_nxo will be deleted. By default, this is 1, but it can be changed by nxm_iter_set().

void nxm_iter_set(cw_nxo_t *a_nxo, uint32_t a_iter):

  Input(s):
    a_nxo:
      Pointer to a handle nxo that was constructed by nxm_new().
    a_iter:
      Garbage collector sweep iteration during which a_nxo will be deleted.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set the garbage collector sweep iteration during which a_nxo will be deleted.

void * nxm_pre_unload_hook_get(cw_nxo_t *a_nxo):

  Input(s):
    a_nxo:
      Pointer to a handle nxo that was constructed by nxm_new().
  Output(s):
    retval:
      A function pointer, or NULL. If non-NULL, the function will be called just before the module is unloaded.
  Exception(s):
    None.
  Description:
    Get the pre-unload hook function associated with a_nxo.

void nxm_pre_unload_hook_set(cw_nxo_t *a_nxo, void (*a_pre_unload_hook)(void)):

  Input(s):
    a_nxo:
      Pointer to a handle nxo that was constructed by nxm_new().
    a_pre_unload_hook:
      A function pointer, or NULL. If non-NULL, the function will be called just before the module is unloaded.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set the pre-unload hook function associated with a_nxo.

Next: 4.10.11 nxn Up: 4.10 Classes Previous: 4.10.9 nxa Contents Index