Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualChisser98

Posted 24 April 2013 - 03:53 PM

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);
}
}
 

 

 
where Class and Method are defined as:
 

 

 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;
};
 

 

 
 
Unfortuantely, my compiler is giving me an error like this:

 

 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);
...
 

 

 
I'm not sure how I would go about passing (whatever it is) I need to pass to the asMETHOD to get this sucker compiled.
 
Anyone have any ideas?

#2Chisser98

Posted 24 April 2013 - 03:53 PM

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);
}
}
 

 

 
where Class and Method are defined as:
 

 

 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;
};
 

 

 
 
Unfortuantely, my compiler is giving me an error like this:

 

 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);
 

 

 
I'm not sure how I would go about passing (whatever it is) I need to pass to the asMETHOD to get this sucker compiled.
 
Anyone have any ideas?

#1Chisser98

Posted 24 April 2013 - 03:52 PM

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);
}
}
 

 

 
where Class and Method are defined as:
 

 

 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;
};
 

 

 
 
Unfortuantely, my compiler is giving me an error like this:

 

 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
 

 

 
 
I'm not sure how I would go about passing (whatever it is) I need to pass to the asMETHOD to get this sucker compiled.
 
Anyone have any ideas?

 

 


PARTNERS