I have seen various examples on how to read an Haxe string in a native C function, but none to create a string and return it to the Haxe code.
In hl.h
a string is defined with this struct:
typedef struct {
hl_type *t;
uchar *bytes;
int length;
} vstring;
based on this definition, should I create a string like this?
HL_PRIM void HL_NAME(create_string)(vstring* st)
{
...
// st is supposed to be an empty string coming from the Haxe side
st->bytes = hl_gc_alloc_noptr(size*2);
st->length = size;
memcpy(st->bytes, ..., size*2);
}