[C++-sig] function with >15 args yields get_signature error
troy d. straszheim
troy at resophonic.com
Mon Oct 26 18:08:42 CET 2009
Eilif Mueller wrote:
> Hi,
>
> Wrapping a function f with 16 arguments:
>
> int f(int x1, int x2, int x3, int x4, int x5,
> int x6, int x7, int x8, int x9, int x10,
> int x11, int x12, int x13, int x14, int x15,
> int x16) {
>
> return x1;
>
> }
>
> BOOST_PYTHON_MODULE(test)
> {
>
> def("f",f);
>
> }
>
>
> yields
>
> /usr/include/boost/python/make_function.hpp: In function ‘boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’:
> /usr/include/boost/python/def.hpp:82: instantiated from ‘boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’
> /usr/include/boost/python/def.hpp:91: instantiated from ‘void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’
> test_module.cpp:20: instantiated from here
> /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to ‘get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))’
> make: *** [stream.o] Error 1
>
>
> whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty.
>
> I need that 16th arg and more ... about 32 args, I think.
>
> Thanks for any help you can offer.
>
This came up recently. You're going to have various problems (not all
boost.python problems) getting arity that large. The workaround is to
introduce an intermediate function that takes a boost::python::tuple
and forward to the zillion-arguments one, example here:
http://gitorious.org/~straszheim/boost/straszheim/blobs/python/libs/python/test/zillion_arguments_workaround.cpp
-t
More information about the Cplusplus-sig
mailing list