For chugins, the API->object->create() method does not invoke the constructor of the type it creates.
E.g.
// Foo object that holds arbitrary data
struct Foo { char buff[256]; }
// default ck constructor of the object we're creating in a function
CK_DLL_CTOR(foo_ctor)
{
// allocates memory to hold struct data
OBJ_MEMBER_UINT(SELF, foo_data_ptr_offset) = (t_CKUINT) new Foo;
}
// function that creates and returns a Foo
CK_DLL_SFUN(create_foo)
{
Chuck_Object* foo_obj = API->object->create(SHRED, fooType, false);
Foo* foo = (Foo*)OBJ_MEMBER_UINT(foo_obj, foo_data_ptr_offset);
// ideally, `foo_ctor` has been called and memory has been allocated
// but from my logging, foo_ctor is actually never called
strcpy(foo->buff, "this will segfault");
RETURN->v_obj = foo_obj;
}
For chugins, the API->object->create() method does not invoke the constructor of the type it creates. E.g.