diff --git a/moo/kernel/FFI.moo b/moo/kernel/FFI.moo index 214cd2b..283bc36 100644 --- a/moo/kernel/FFI.moo +++ b/moo/kernel/FFI.moo @@ -65,5 +65,7 @@ class FFI(Object) rc := self.ffi call(f, sig, args). if (rc isError) { FFIException signal: ('Unable to call %s' strfmt(name)) }. + + ^rc. } } diff --git a/moo/mod/ffi.c b/moo/mod/ffi.c index 96c3d42..2b64393 100644 --- a/moo/mod/ffi.c +++ b/moo/mod/ffi.c @@ -216,6 +216,7 @@ static moo_pfrc_t pf_call (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) i++; } + /* check argument signature */ for (j = 0; i < MOO_OBJ_GET_SIZE(sig); i++) { moo_ooch_t fmtc; @@ -344,6 +345,7 @@ static moo_pfrc_t pf_call (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) if (i >= MOO_OBJ_GET_SIZE(sig)) goto call_void; + /* check the return value type in signature */ switch (MOO_OBJ_GET_CHAR_VAL(sig, i)) { /* TODO: support more types... */