I'm trying to create a wrapper class to automate some of the anglescript setup. I would like to be able to wrap this function:
virtual int RegisterGlobalFunction(const char *declaration, const asUPtr &funcPointer, asDWORD callConv) = 0;
To use the RegisterGlobalFunction, you have to wrap the function address in a 'asFunction' macro like:
r = engine->RegisterGlobalFunction("void Print(string &in)", asFUNCTION(PrintString), asCALL_CDECL); assert( r >= 0 );
So I would like to somehow get rid of this, and automatically do this.
My first go was this:
void TScript::ExposeFn( const std::string *declaration, const asUPtr &funcPointer )
but then I think I need the macro wrapper again. So I would really like something like:
void TScript::ExposeFn( const std::string *declaration, fnPtr &funcPointer )
where funcPointer could have any type of arguments and the underlying code would wrap the passed function in asFUNCTION and then pass it off to the angelscript function. I'm just not sure a)if this can be done b)how to
any pointers would be great!
Cheers