mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-16 16:20:49 +00:00
test(runtime-c-api) Fix compilation errors in test-import-function.c
.
This commit is contained in:
parent
2a0e42c1e5
commit
603f1fc57d
@ -4,14 +4,14 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
static print_str_called = false;
|
||||
static memory_len = 0;
|
||||
static ptr_len = 0;
|
||||
static bool print_str_called = false;
|
||||
static int memory_len = 0;
|
||||
static int ptr_len = 0;
|
||||
static char actual_str[14] = {};
|
||||
|
||||
void print_str(wasmer_instance_context_t *ctx, int32_t ptr, int32_t len)
|
||||
{
|
||||
wasmer_memory_t *memory = wasmer_instance_context_memory(ctx, 0);
|
||||
const wasmer_memory_t *memory = wasmer_instance_context_memory(ctx, 0);
|
||||
uint32_t mem_len = wasmer_memory_length(memory);
|
||||
uint8_t *mem_bytes = wasmer_memory_data(memory);
|
||||
for (int32_t idx = 0; idx < len; idx++)
|
||||
@ -31,16 +31,16 @@ int main()
|
||||
wasmer_value_tag returns_sig[] = {};
|
||||
|
||||
printf("Creating new func\n");
|
||||
wasmer_import_func_t *func = wasmer_import_func_new(print_str, params_sig, 2, returns_sig, 0);
|
||||
const wasmer_import_func_t *func = wasmer_import_func_new((void (*)(void *)) print_str, params_sig, 2, returns_sig, 0);
|
||||
wasmer_import_t import;
|
||||
|
||||
char *module_name = "env";
|
||||
wasmer_byte_array module_name_bytes;
|
||||
module_name_bytes.bytes = module_name;
|
||||
module_name_bytes.bytes = (const uint8_t *) module_name;
|
||||
module_name_bytes.bytes_len = strlen(module_name);
|
||||
char *import_name = "print_str";
|
||||
wasmer_byte_array import_name_bytes;
|
||||
import_name_bytes.bytes = import_name;
|
||||
import_name_bytes.bytes = (const uint8_t *) import_name;
|
||||
import_name_bytes.bytes_len = strlen(import_name);
|
||||
|
||||
import.module_name = module_name_bytes;
|
||||
@ -88,4 +88,4 @@ int main()
|
||||
printf("Destroy instance\n");
|
||||
wasmer_instance_destroy(instance);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user