Hi!
I have some methods returning objects instead of pointers, e.g. (simplified)
=======
class Selection{void*ptr; int type;};
Selection find(const char*);
=======
If I use (define-c Selection find (string)) the generated code assumes that a pointer is returned: sexp_make_cpointer(ctx, sexp_unbox_fixnum(sexp_opcode_return_type(self)), find(sexp_string_data(arg0)), SEXP_FALSE, 0);
How to properly handle such cases? My current attempt is
========
auto *sel = static_cast<Selection*>(sexp_alloc(ctx, sizeof(Selection)));
*sel = find(s);
return sexp_make_cpointer(ctx, sexp_type_tag(SelectionType), sel, nullptr, 0);
========
But i'm not sure.