I'm struggling registering class constructor and destructors following the example in “Registering a Value Type”. For,
r = m_pEngine->RegisterObjectType("Motor", sizeof(Motor), asOBJ_VALUE); assert(r >= 0);
The example implies I cannot register Motor::Motor(); that a “factory function” should be use? It looks like the example is registering a global Constructor(void *memory), not a class member. So I have,
void CallConstructor(void* memory)
{
new(memory) Motor();
}
r = mpEngine->RegisterObjectBehaviour("Motor", asBEHAVE_CONSTRUCT, "void CallConstructor(void*)", WRAP_CON(CallConstuctor, void*), asCALL_GENERIC); assert(r >= 0);
Compiler error: type/value mismatch as argument 1 in template parameter list for ‘template<class T> struct gw::Constuctor’ … and later “expected a type, got 'CallConstuctor'. ClassType ”Motor" doesn't seem to make sense, but the WRAP_CON template indicates that a typename is what is expected.
How is this done with generic wrappers (I'm on arm64)?