For some reason trying to pass a pointer to this function to a varadic function produces the following error:
1>c:\... : error C2664: 'PyArg_ParseTuple' : cannot convert parameter 3 from 'int (__cdecl *)(PyObject *,void *)' to '...'
1> Context does not allow for disambiguation of overloaded function
PyArg_ParseTuple(args, "O&O&:CreateWindow",
&Arg_Size2U<1>, &size,
&Arg_String<2>, &title);
I'm not sure what the problem is, since the template function has no over loads, and the template paremeters are defined explicitly, so theres no question over which function to pass a pointer for...
Is there some way around this that does not invlove create lots of versions for each argument conversion function, but can still have the argument number in the exception if there an error? (Better yet some way to pass the argument number as a paremeter, so there are not multiple copies of the function in my dll.)
EDIT: This also seems to result in compile errors. Is there no way to create a function pointer to a template function, or do I need to do it diffrently from normal functions?
int (*sizeConv)(PyObject *,void *) = Arg_MakeSize2U<1>;
1>c:\... : error C2440: 'initializing' : cannot convert from 'int (__cdecl *)(PyObject *,void *)' to 'int (__cdecl *)(PyObject *,void *)'
1> None of the functions with this name in scope match the target type
The function is declared as:
template<int ARG> int Arg_MakeSize2U(PyObject *obj, void *out)
EDIT2: adding the address of operator gave yet another diffrent error...
int (*sizeConv)(PyObject *,void *) = &Arg_MakeSize2U<1>;
1>c:\... : error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'int (__cdecl *)(PyObject *,void *)'
1> None of the functions with this name in scope match the target type