Ok... Here's the minimal code I'm using:
class Test2 { public: Test2(int a, int b); virtual ~Test2(); void Constructor(int a, int b, Test2* instance); public: static void AngelScriptRegister(asIScriptEngine* pEngine); public: int m_nA; int m_nB;};...void Test2::Constructor(int a, int b, Test2* instance) { new(instance) Test2(a, b);}
I've tried to register Constructor as:
r = pEngine->RegisterObjectBehaviour( "Test2", asBEHAVE_CONSTRUCT, "void Constructor(int a, int b)", asMETHOD(Test2, Constructor), asCALL_THISCALL);
Constructor is called, but I get ESP error. Then I tried:
r = pEngine->RegisterObjectBehaviour( "Test2", asBEHAVE_CONSTRUCT, "void Constructor(int a, int b, Test2∈)", asMETHOD(Test2, Constructor), asCALL_THISCALL);
In this case, return code (r) is ok, but Constructor isn't called. Then I tried with handles (AddRef and Release are registered):
r = pEngine->RegisterObjectBehaviour( "Test2", asBEHAVE_CONSTRUCT, "void Constructor(int a, int b, Test2@)", asMETHOD(Test2, Constructor), asCALL_THISCALL);
Again, Constructor is not called (return value r was ok)
Is there a combination I haven't tried? :)
Thnx