Add export_name and export_func

This commit is contained in:
Brandon Fish
2019-02-14 00:00:39 -06:00
parent 93979aeae2
commit bfd5e21605
4 changed files with 190 additions and 5 deletions

View File

@ -38,12 +38,17 @@ typedef struct {
} wasmer_export_t;
typedef struct {
} wasmer_exports_t;
const uint8_t *bytes;
uint32_t bytes_len;
} wasmer_byte_array;
typedef struct {
} wasmer_global_t;
} wasmer_func_t;
typedef struct {
} wasmer_exports_t;
typedef union {
int32_t I32;
@ -57,6 +62,10 @@ typedef struct {
wasmer_value value;
} wasmer_value_t;
typedef struct {
} wasmer_global_t;
typedef struct {
bool mutable_;
wasmer_value_tag kind;
@ -80,6 +89,16 @@ typedef struct {
*/
wasmer_import_export_kind wasmer_export_kind(wasmer_export_t *export_);
/**
* Gets func from wasm_export
*/
wasmer_byte_array wasmer_export_name(wasmer_export_t *export_);
/**
* Gets func from wasm_export
*/
const wasmer_func_t *wasmer_export_to_func(wasmer_export_t *export_);
/**
* Frees the memory for the given exports
*/
@ -95,6 +114,19 @@ wasmer_export_t *wasmer_exports_get(wasmer_exports_t *exports, int idx);
*/
int wasmer_exports_len(wasmer_exports_t *exports);
/**
* Calls a `func` with the provided parameters.
* Results are set using the provided `results` pointer.
* Returns `wasmer_result_t::WASMER_OK` upon success.
* Returns `wasmer_result_t::WASMER_ERROR` upon failure. Use `wasmer_last_error_length`
* and `wasmer_last_error_message` to get an error message.
*/
wasmer_result_t wasmer_func_call(wasmer_func_t *func,
const wasmer_value_t *params,
int params_len,
wasmer_value_t *results,
int results_len);
/**
* Frees memory for the given Global
*/