berry: Constructor that take ptr as argument never called

Here is the following berry code :

Foo = Get_Ptr()
print(Foo) # print : <ptr: 0x3fca0a64> for example

Bar = Module.Test(Foo) #Class constructor taking pointer as argument
Bar = Module.Test(15)

The constructor is declared as CTYPE_FUNC with berry mapping as follows :

class Test_Class()
{
// Stuf here
};

void* Test_Init(bvm* VM, void* PTR)
{
Log_Format("Test_Init with ptr : %p", PTR);
return be_malloc(VM, sizeof(Test_Class));
}
BE_FUNC_CTYPE_DECLARE(Test_Init, "+_p", "@.")

// Berry mapping @const_object_info_begin declaration of the class and module

Once the code is ran, Bar = Test(Foo) is never called, but Bar = Test(15) is (of course invalid). I don’t understand why, since there’s no type checking on the last argument. It’s maybe related to berry mapping ? I didn’t get any exception thrown by the VM.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

Sorry not yet. I tried a quick fix but it failed