runtime-c-api:

* import.rs - adding `import_object_t` and `wasmer_import_object_destroy`
* instance.rs - adding `wasmer_module_import_instantiate`
This commit is contained in:
Yaron Wittenstein
2019-08-01 10:48:03 +03:00
parent 2b6e58962b
commit ab76755ade
5 changed files with 79 additions and 3 deletions

View File

@ -95,6 +95,10 @@ typedef struct {
typedef struct {
} wasmer_import_object_t;
typedef struct {
} wasmer_instance_t;
typedef struct {
@ -392,6 +396,11 @@ wasmer_result_t wasmer_import_func_returns(const wasmer_import_func_t *func,
wasmer_result_t wasmer_import_func_returns_arity(const wasmer_import_func_t *func,
uint32_t *result);
/**
* Frees memory of the given ImportObject
*/
void wasmer_import_object_destroy(wasmer_import_object_t *import_object);
/**
* Calls an instances exported function by `name` with the provided parameters.
* Results are set using the provided `results` pointer.
@ -526,6 +535,16 @@ wasmer_result_t wasmer_module_deserialize(wasmer_module_t **module,
*/
void wasmer_module_destroy(wasmer_module_t *module);
/**
* Given:
* A prepared `wasmer svm` import-object
* A compiled wasmer module
* Instantiates a wasmer instance
*/
wasmer_result_t wasmer_module_import_instantiate(wasmer_instance_t **instance,
const wasmer_module_t *module,
const wasmer_import_object_t *import_object);
/**
* Creates a new Instance from the given module and imports.
* Returns `wasmer_result_t::WASMER_OK` upon success.