From: Thomas Geymayer Date: Sat, 22 Mar 2014 12:23:21 +0000 (+0100) Subject: cppbind: fix problem with function call without arguments. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=09d47e7f55bca5142db676c514c4cb6ccd95eb33;p=simgear.git cppbind: fix problem with function call without arguments. --- diff --git a/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx b/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx index 6b788122..83f1216b 100644 --- a/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx +++ b/simgear/nasal/cppbind/detail/from_nasal_function_templates.hxx @@ -21,13 +21,16 @@ BOOST_PP_ENUM_TRAILING(n, SG_CALL_TRAITS_PARAM, 0) ) { naContext ctx = naNewContext(); - naRef args[] = { +#if n + naRef args[n] = { BOOST_PP_ENUM(n, SG_CALL_ARG, 0) }; - const int num_args = sizeof(args)/sizeof(args[0]); +#else + naRef* args = NULL; +#endif naRef result = - naCallMethodCtx(ctx, holder->get_naRef(), self, num_args, args, naNil()); + naCallMethodCtx(ctx, holder->get_naRef(), self, n, args, naNil()); const char* error = naGetError(ctx); std::string error_str(error ? error : "");