Home:ALL Converter>creating an angelscript asSMethodPtr (without the asMETHOD macro)

creating an angelscript asSMethodPtr (without the asMETHOD macro)

Ask Time:2013-04-27T03:39:08         Author:Jarrett

Json Formatter

I'm trying to get a more dynamic workflow with Angelscript happening, where I don't rely on the asMETHOD macro to pass class/method information to Angelscript.

However, I'm unable to get it to work so far.

Here's some structs I've defined (with which to setup Class and Method data):

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

Later on, I try to create an asSMethodPtr struct object using a Class struct object I had created earlier. This is what I do:

auto methodPtr = asSMethodPtr<sizeof(void (classObject.pointer)())>::Convert((void (classObject.pointer)())(classObject.addRefMethodPointer));

Unfortunately, this results in the following errors:

src/common/as_wrapper/AngelScript.cpp:98:66: error: void value not ignored as it ought to be
src/common/as_wrapper/AngelScript.cpp:98:68: error: template argument 1 is invalid
src/common/as_wrapper/AngelScript.cpp:98:107: error: void value not ignored as it ought to be
src/common/as_wrapper/AngelScript.cpp:98:142: error: unable to deduce ‘auto’ from ‘<expression error>’

Anyone have any ideas? I've afraid this asSMethodPtr struct is pushing the limits of my C++ abilities...

Author:Jarrett,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/16244004/creating-an-angelscript-assmethodptr-without-the-asmethod-macro
yy