Original Post
Hi, I've uploaded and tested the new 1.10 version in our engine and we've encountered a problem with global properties that are pointers to classes. I’ve registered a class with: engine->RegisterObjectType("class1", sizeof(Class1), asOBJ_CLASS); // or use asOBJ_GUESS After that registered a global property as a pointer to this class with: engine->RegisterGlobalProperty("class1 *pnt", &pnt); Registered a function member with: engine->RegisterObjectMethod("class1", "void function()", asFUNCTION(function), asCALL_CDECL_OBJFIRST); Trying to execute the function in the script gives me the following compilation error: No matching signatures to “function()” Illegal operation on this datatype Trying to use a member variable crashes the compilation. Here is a test application (constructed in your framework test): #include "utils.h" #define TESTNAME "TestGlobalObjectPointer" class Class1 { }; static void function(Class1 *_this) { } bool TestGlobalObjPointer() { bool fail = false; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->RegisterObjectType("class1", sizeof(Class1), asOBJ_CLASS); engine->RegisterObjectType("factory", 0, 0); // Register an object. Class1 obj; engine->RegisterGlobalProperty("class1 obj", &obj); // Register a pointer to object. Class1 *pnt = &obj engine->RegisterGlobalProperty("class1 *pnt", &pnt); // Register class function. engine->RegisterObjectMethod("class1", "void function()", asFUNCTION(function), asCALL_CDECL_OBJFIRST); COutStream out; // Function call executed fine when using an object. int r = engine->ExecuteString(0, "obj.function();", &out); if( r < 0 ) { printf("%s: ExecuteString() failed %d\n", TESTNAME, r); fail = true; } // BUG??!! FUNCTION CALL WILL FAIL WHEN USING AN OBJECT POINTER. r = engine->ExecuteString(0, "pnt->function();", &out); if( r < 0 ) { printf("%s: ExecuteString() failed %d\n", TESTNAME, r); fail = true; } // WHEN USING A POINTER TO ACCESS A MEMBER VARIABLE COMPILING CRASHES. engine->Release(); return fail; } Now, probably this is related to previous discussions about removing pointers in Angel Script. If this is not a bug but rather a scripting aspect that is dropped, is it possible to do the same thing with references? Note that I’m not declaring any class objects in the script but rather all the engine interfaces are registered with the scripting engine as global properties. Regards, Adrian Licu Quad Software