Add function to get export from ns/name via ImportObject to C API

This commit is contained in:
Mark McCaskey
2019-10-09 17:29:27 -07:00
parent bfb9d3849c
commit 913354adb3
5 changed files with 184 additions and 14 deletions

View File

@ -10,10 +10,10 @@
* List of export/import kinds.
*/
enum wasmer_import_export_kind {
WASM_FUNCTION,
WASM_GLOBAL,
WASM_MEMORY,
WASM_TABLE,
WASM_FUNCTION = 0,
WASM_GLOBAL = 1,
WASM_MEMORY = 2,
WASM_TABLE = 3,
};
typedef uint32_t wasmer_import_export_kind;
@ -469,6 +469,22 @@ wasmer_result_t wasmer_import_object_extend(wasmer_import_object_t *import_objec
wasmer_import_t *imports,
unsigned int imports_len);
/**
* Gets an entry from an ImportObject at the name and namespace.
* Stores an immutable reference to `name` and `namespace` in `import`.
*
* The caller owns all data involved.
* `import_export_value` will be written to based on `tag`, `import_export_value` must be
* initialized to point to the type specified by `tag`. Failure to do so may result
* in data corruption or undefined behavior.
*/
wasmer_result_t wasmer_import_object_get_import(const wasmer_import_object_t *import_object,
wasmer_byte_array namespace_,
wasmer_byte_array name,
wasmer_import_t *import,
wasmer_import_export_value *import_export_value,
uint32_t tag);
/**
* Creates a new empty import object.
* See also `wasmer_import_object_append`