In case anyone faces the same issue: I solved the problem.
I had to redefine the c++ function to:
void mycppfunction(double myarray[], size_t len);
Then I had to add "len" to the definemylib.mlx file to:
defineArgument(mycppfunctionDefinition, "myarray", "clib.array.mylib.Double", "input", "len").
Now it works.