Fix socket-api send/recv issue and c-api sample callback_chain issue (#1158)

Re-implement socket api send/recv in an atomic-like way, fix the return value
check in posix.c.
And fix wasm-c-api sample callback_chain calling malloc issue.
This commit is contained in:
liang.he
2022-05-09 16:52:43 +08:00
committed by GitHub
parent 362bd0cc5c
commit 3ba2d7e7de
3 changed files with 99 additions and 35 deletions

View File

@ -60,7 +60,17 @@ enum EXPORT_ITEM_NAME {
DEFINE_FUNCTION(get_pairs)
{
call_wasm_function(e_malloc, args, results, "malloc");
wasm_val_vec_t as = { 0 };
wasm_val_t data[1] = { WASM_I32_VAL(10) };
wasm_val_vec_new(&as, 1, data);
if (as.data == NULL) {
printf("ERROR: create parameters failed\n");
return NULL;
}
call_wasm_function(e_malloc, &as, results, "malloc");
wasm_val_vec_delete(&as);
return NULL;
}