hey all
I'm writing a thin wrapper for Angelscript for my game.
I'm a little unsure how to actually 'wrap' the asMETHOD macro.
I've got something like this so far:
void AngelScript::registerClass(Class classObject, std::vector<Method> methods)
{
registerObjectType(classObject.name.c_str(), 0, asOBJ_REF);
registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_FACTORY, classObject.factorySignature.c_str(), asFUNCTION(classObject.factoryPointer), asCALL_CDECL);
registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_ADDREF, "void f()", asMETHOD(classObject.pointer, classObject.addRefMethodPointer), asCALL_THISCALL);
registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_RELEASE, "void f()", asMETHOD(classObject.pointer, classObject.releaseRefMethodPointer), asCALL_THISCALL);
for ( Method m : methods)
{
registerMethod(classObject, m);
}
}
struct Class {
std::string name;
std::string factorySignature;
void* pointer;
void* factoryPointer;
void* addRefMethodPointer;
void* releaseRefMethodPointer;
};
struct Method {
std::string name;
std::string signature;
void* pointer;
};
src/common/as_wrapper/AngelScript.cpp: In member function ‘void as_wrapper::AngelScript::registerClass(as_wrapper::Class, std::vector<as_wrapper::Method>)’:
src/common/as_wrapper/AngelScript.cpp:100:160: error: template argument 1 is invalid
src/common/as_wrapper/AngelScript.cpp:101:165: error: template argument 1 is invalid
Where line 100 and 101 are these two lines:
...
registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_ADDREF, "void f()", asMETHOD(classObject.pointer, classObject.addRefMethodPointer), asCALL_THISCALL);
registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_RELEASE, "void f()", asMETHOD(classObject.pointer, classObject.releaseRefMethodPointer), asCALL_THISCALL);
...