Hello, it's me
In needed in my project a function with four arguments. So I got the definition added to obj.h and objfunc.c.
maybe it needed someone else also.
Perhaps also an opportunity: to defined dynamically function for x arguments.
Just as a note.
MP_DEFINE_CONST_FUN_OBJ
Re: MP_DEFINE_CONST_FUN_OBJ
For 4 or more arguments (or a varying number of arguments) you should use the MP_DEFINE_CONST_FUN_OBJ_VAR or MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN macros. Eg, for 4 args it could be:
Code: Select all
STATIC mp_obj_t mp_func_with_4_args(mp_uint_t n_args, const mp_obj_t *args) {
(void)n_args; // unused, we know it's 4
// args[0], args[1], args[2], args[3] contain the 4 arguments
// do processing...
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(my_func_with_4_args_obj, 4, 4, my_func_with_4_args);