From a59ce13810f16e7cf0b254fecb3615218c00d921 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 27 Mar 2019 10:50:40 +0100 Subject: [PATCH] chore(runtime-c-api) Build the C and C++ headers. --- lib/runtime-c-api/wasmer.h | 16 ++++++++++++---- lib/runtime-c-api/wasmer.hh | 14 ++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/runtime-c-api/wasmer.h b/lib/runtime-c-api/wasmer.h index 7461b4d1f..d11deab11 100644 --- a/lib/runtime-c-api/wasmer.h +++ b/lib/runtime-c-api/wasmer.h @@ -66,6 +66,10 @@ typedef struct { typedef struct { +} wasmer_memory_t; + +typedef struct { + } wasmer_exports_t; typedef struct { @@ -99,10 +103,6 @@ typedef struct { typedef struct { -} wasmer_memory_t; - -typedef struct { - } wasmer_table_t; typedef union { @@ -241,6 +241,14 @@ wasmer_byte_array wasmer_export_name(wasmer_export_t *export_); */ const wasmer_export_func_t *wasmer_export_to_func(const wasmer_export_t *export_); +/** + * Gets a memory pointer from an export 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_export_to_memory(const wasmer_export_t *export_, wasmer_memory_t **memory); + /** * Frees the memory for the given exports */ diff --git a/lib/runtime-c-api/wasmer.hh b/lib/runtime-c-api/wasmer.hh index d90c22910..7b22732d0 100644 --- a/lib/runtime-c-api/wasmer.hh +++ b/lib/runtime-c-api/wasmer.hh @@ -61,6 +61,10 @@ struct wasmer_export_t { }; +struct wasmer_memory_t { + +}; + struct wasmer_exports_t { }; @@ -94,10 +98,6 @@ struct wasmer_instance_context_t { }; -struct wasmer_memory_t { - -}; - struct wasmer_table_t { }; @@ -210,6 +210,12 @@ wasmer_byte_array wasmer_export_name(wasmer_export_t *export_); /// Gets export func from export const wasmer_export_func_t *wasmer_export_to_func(const wasmer_export_t *export_); +/// Gets a memory pointer from an export 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_export_to_memory(const wasmer_export_t *export_, wasmer_memory_t **memory); + /// Frees the memory for the given exports void wasmer_exports_destroy(wasmer_exports_t *exports);