Skip to content

Commit

Permalink
chore(runtime-c-api) Update C/C++ headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jan 15, 2020
1 parent bcbde69 commit cd16a7d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
36 changes: 18 additions & 18 deletions lib/runtime-c-api/wasmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,24 +675,6 @@ wasmer_import_object_iter_t *wasmer_import_object_iterate_functions(const wasmer
*/
wasmer_import_object_t *wasmer_import_object_new(void);

/**
* Stop the execution of a host function, aka imported function. The
* function must be used _only_ inside a host function.
*
* The pointer to `wasmer_instance_context_t` is received by the host
* function as its first argument. Just passing it to `ctx` is fine.
*
* The error message must have a greater lifetime than the host
* function itself since the error is read outside the host function
* with `wasmer_last_error_message`.
*
* This function returns `wasmer_result_t::WASMER_ERROR` if `ctx` or
* `error_message` are null.
*
* This function never returns otherwise.
*/
wasmer_result_t wasmer_import_trap(const wasmer_instance_context_t *ctx, const char *error_message);

/**
* Calls an instances exported function by `name` with the provided parameters.
* Results are set using the provided `results` pointer.
Expand Down Expand Up @@ -998,6 +980,24 @@ const wasmer_trampoline_callable_t *wasmer_trampoline_buffer_get_trampoline(cons
void *wasmer_trampoline_get_context(void);
#endif

/**
* Stop the execution of a host function, aka imported function. The
* function must be used _only_ inside a host function.
*
* The pointer to `wasmer_instance_context_t` is received by the host
* function as its first argument. Just passing it to `ctx` is fine.
*
* The error message must have a greater lifetime than the host
* function itself since the error is read outside the host function
* with `wasmer_last_error_message`.
*
* This function returns `wasmer_result_t::WASMER_ERROR` if `ctx` or
* `error_message` are null.
*
* This function never returns otherwise.
*/
wasmer_result_t wasmer_trap(const wasmer_instance_context_t *ctx, const char *error_message);

/**
* Returns true for valid wasm bytes and false for invalid bytes
*/
Expand Down
32 changes: 16 additions & 16 deletions lib/runtime-c-api/wasmer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -542,22 +542,6 @@ wasmer_import_object_iter_t *wasmer_import_object_iterate_functions(const wasmer
/// See also `wasmer_import_object_append`
wasmer_import_object_t *wasmer_import_object_new();

/// Stop the execution of a host function, aka imported function. The
/// function must be used _only_ inside a host function.
///
/// The pointer to `wasmer_instance_context_t` is received by the host
/// function as its first argument. Just passing it to `ctx` is fine.
///
/// The error message must have a greater lifetime than the host
/// function itself since the error is read outside the host function
/// with `wasmer_last_error_message`.
///
/// This function returns `wasmer_result_t::WASMER_ERROR` if `ctx` or
/// `error_message` are null.
///
/// This function never returns otherwise.
wasmer_result_t wasmer_import_trap(const wasmer_instance_context_t *ctx, const char *error_message);

/// Calls an instances exported function by `name` with the provided parameters.
/// Results are set using the provided `results` pointer.
///
Expand Down Expand Up @@ -793,6 +777,22 @@ const wasmer_trampoline_callable_t *wasmer_trampoline_buffer_get_trampoline(cons
void *wasmer_trampoline_get_context();
#endif

/// Stop the execution of a host function, aka imported function. The
/// function must be used _only_ inside a host function.
///
/// The pointer to `wasmer_instance_context_t` is received by the host
/// function as its first argument. Just passing it to `ctx` is fine.
///
/// The error message must have a greater lifetime than the host
/// function itself since the error is read outside the host function
/// with `wasmer_last_error_message`.
///
/// This function returns `wasmer_result_t::WASMER_ERROR` if `ctx` or
/// `error_message` are null.
///
/// This function never returns otherwise.
wasmer_result_t wasmer_trap(const wasmer_instance_context_t *ctx, const char *error_message);

/// Returns true for valid wasm bytes and false for invalid bytes
bool wasmer_validate(const uint8_t *wasm_bytes, uint32_t wasm_bytes_len);

Expand Down

0 comments on commit cd16a7d

Please sign in to comment.