asFUNCTION and asCALL_GENERIC
I have the following issue. I have a wrapper class around asIScriptEngine which register the syntax. One of this class functions, RegClassFunc, registers the a class function:
t_error nASEngine::RegClassFunc(const char *class_name, const char *decl, const void *func_pnt)
{
if(_as_engine->RegisterObjectMethod(class_name, decl,
asFUNCTION(func_pnt), asCALL_GENERIC) < 0)
{
return C_GENERIC_ERROR;
}
return C_GENERIC_SUCCESS;
}
func_pnt is the pointer to the class function which is a global function. As you can see I am using the generic convention call (so it works on 64bit).
The problem with the above call is that the asFUNCTION macro will resolve to
template <class T> inline asSFuncPtr asFunctionPtr(T func)
instead of
template<> inline asSFuncPtr asFunctionPtr<asGENFUNC_t>(asGENFUNC_t func)
and thus the generic convention call checks will fail in DetectCallingConvention (as_callfunc.cpp) due to asSFuncPtr.flag being 2. I assume this is because the asFUNCTION is called inside a class.
All is ok If I don't use generic calling convention or if I make the RegisterObjectMethod call outside nASEngine class (in global name space).
For now I've resolved the problem by using my own version of asSFuncPtr macro.
Regards,
Adrian L.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement