Hello,
I'm learning how to bind C++ classes to Angelscript, but I've run into a problem, when adding a copy constructor to a class, the application crashes. I'm pretty sure that I'm doing something wrong because I can't seem to find an example on how to do this properly.
The class I'm registering is a simple 3D vector with 3 floats (x,y,z).
The class registration:
int r = engine->RegisterObjectType("vec3f", sizeof(vec3f), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
copy constructor registration:
r = engine->RegisterObjectBehaviour("vec3f", asBEHAVE_CONSTRUCT, "void f(const vec3f &in)", asFUNCTION(vec3fCopyConstructor), asCALL_CDECL_OBJLAST);
the function 'vec3fCopyConstructor':
void vec3fCopyConstructor(void *memory, const vec3f& other)
{
new(memory) vec3f(other);
}
Thanks a lot in advance for any help,