Maximum number of arguments of a foreign function

Hi,
I’m developing an application using the C interface. However, i get the following error

Too many arguments to foreign function func/11 (>10)

is there a particular reason to have at most 10 arguments or it is just an arbitrary value? Thanks

Each argument count requires a VM instruction. At some point this gets a little boring :slight_smile: After having answered the question whether you really want this many arguments though, there is an alternative: use the PL_FA_VARARGS flag for PL_register_foreign() to can get the function called as

f(term_t t0, int arity, void *context)

See SWI-Prolog -- API-function PL_register_foreign_in_module for an example. This is also the calling convention used internally as well as by the C++ interface. It is more recent and a bit less natural, but faster and more flexible.