Skip to content

Is the current C API complete enough for porting this Rust code? #2465

Answered by lucianoiam
lucianoiam asked this question in Q&A
Discussion options

You must be logged in to vote

For anyone interested, this is not an exact translation of the code above but enough for allowing unmodified AssemblyScript compiled modules to run:

#define own

static inline own wasm_functype_t* wasm_functype_new_4_0(
  own wasm_valtype_t* p1, own wasm_valtype_t* p2, own wasm_valtype_t* p3, own wasm_valtype_t* p4
) {
    wasm_valtype_t* ps[4] = {p1, p2, p3, p4};
    wasm_valtype_vec_t params, results;
    wasm_valtype_vec_new(&params, 4, ps);
    wasm_valtype_vec_new_empty(&results);
    return wasm_functype_new(&params, &results);
}

own wasm_trap_t* abort(const wasm_val_vec_t* args, wasm_val_vec_t* results) {
    return NULL;
}

... 

    wasm_functype_t *abortFuncType = wasm_functype…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lucianoiam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant