It looks like there are 2 places that need to change - rpc.h and Base.h.
Here's what I did in my project:
1. Added this to myrpc.h (or other rpc-able class header)
#include "Base.h"
#include "mbed.h"
#ifdef MBED_RPC
#include "rpc.h"
#endif
namespace mbed {
// Fixing rpc.h limitation of 4 arguments.
#ifdef MBED_RPC
template<typename R, typename A1, typename A2, typename A3, typename A4, typename A5, R (*func)(A1,A2,A3,A4,A5)>
void rpc_function_caller(const char *arguments, char *result) {
const char *next = arguments;
A1 arg1 = parse_arg<A1>(next_arg(next),&next);
A2 arg2 = parse_arg<A2>(next_arg(next),&next);
A3 arg3 = parse_arg<A3>(next_arg(next),&next);
A4 arg4 = parse_arg<A4>(next_arg(next),&next);
A5 arg5 = parse_arg<A5>(next_arg(next),NULL);
R res = (*func)(arg1,arg2,arg3,arg4,arg5);
if(result != NULL) {
write_result<R>(res, result);
}
}
#endif
...
2. Copied Base.h from SVN into project (I just used browser http://mbed.org/projects/libraries/svn/mbed/trunk/Base.h, copy-pasted and removed leading line numbers). Then added this to the end of the Base class:
template
static const char *construct(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) {
Base *p = new C(arg1,arg2,arg3,arg4,arg5);
p->_from_construct = true;
if(p->_name==NULL) {
p->register_object(new_name(p));
}
return p->_name;
}
It compiles!!
Of course I still would want to see Base.h updated with more construct templates and rpc.h updated with more rpc_function_caller templates. After all, 4 arguments is such a small limitation, for 26 pins of available IO I think rpc should support up to 27 arguments (one for object name passing to Base).
Just needed to add one more PinName argument to an RPC function, and compiler barked. I found out that rpc.h has only up to 4 arguments, and I'm trying to use 5. Can someone add templates with more arguments (maybe up to 10) to rpc.h?