It sounds like you want to register TestClass in the application interface. In which case, take a look at the documentation here: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_register_type.html
Basically, you would do something like this in C++: (untested)
class TestClass
{
private:
int mRefCount = 0;
public:
int mInt;
float mFloat;
public:
void AddRef() { mRefCount++; }
void Release()
{
if (--mRefCount == 0) {
delete this;
}
}
};
static TestClass* GetTestClassInstance()
{
TestClass* ret = new TestClass;
ret->mInt = 11;
ret->mFloat = 3.33f;
return ret;
}
void RegisterTestClass()
{
int r;
// Register TestClass
r = gEngine->RegisterObjectType("TestClass", sizeof(TestClass), asOBJ_REF); assert(r >= 0);
r = gEngine->RegisterObjectBehaviour("TestClass", asBEHAVE_ADDREF, "void f()", asMETHOD(TestClass, AddRef), asCALL_THISCALL); assert(r >= 0);
r = gEngine->RegisterObjectBehaviour("TestClass", asBEHAVE_RELEASE, "void f()", asMETHOD(TestClass, Release), asCALL_THISCALL); assert(r >= 0);
r = gEngine->RegisterObjectProperty("TestClass", "int mInt", asOFFSET(TestClass, mInt)); assert(r >= 0);
r = gEngine->RegisterObjectProperty("TestClass", "float mInt", asOFFSET(TestClass, mFloat)); assert(r >= 0);
// Register function to get test class instance
r = gEngine->RegisterGlobalFunction("TestClass@ GetTestClassInstance()", asFUNCTION(GetTestClassInstance), asCALL_CDECL); assert(r >= 0);
}
And then just call GetTestClassInstance() in your script, you don't have to write the entire class structure in your script, it will already be registered by the application.
Note that I've added the AddRef/Release methods, which are called by the ADDREF and RELEASE behaviors, since I'm guessing you want to do it with handles.
I've also used asCALL_CDECL above for the global function (we've never really had any compatibility issues, so we just never really bother with generic calling convention). Also, what's ScriptParams in your example? I assume it's something that implements asIScriptGeneric?
As for your question on the "block of memory", yes, if you're using handles, then you basically just give Angelscript and pointer and it'll pass that along just like in C++. It will then know which offsets to use for properties from RegisterObjectProperty. It's not "mapping" on top of a type defined in scripts.
Make sure you read the documentation though, it explains it much better than I ever could explain it.