samedi 27 décembre 2014

Mapping functions with variable arguments and calling by string c++

I would like to have some fair idea how to map functions with variable arguments,return type of int and call it by a string..

Just for an example...



int func1(int a, int b);
int func2(int a1, int b1 , int* c1);
int func3(char* dummy);


int func4(double x, long y , int z , char** table);

int func5(double d1, double b1);

int func6(int* p, double* q , int i);`


I just need a common function called



int CallFunction("funcname",param1,param2,...);



for example



CallFunction("func1",10,20); /* calling function func1 and return func1 result*/



I know how to map functions using functions pointers having constant arguments but variable arguments seems to be complicated.. could anyone shower some idea how to do it.


I even explored Variadic templates.. But seems to complicated calling functions using strings..


Aucun commentaire:

Enregistrer un commentaire