Convert back cstring to string

2023-08-22 Thread mratsim
It would be easier with actual function signatures. The GC_ref / GC_unref might only work for --mm:refc, unsure about --mm:arc I would just use `$myCString` and worry about zero-copy if allocation becomes a bottleneck that shows up in profiling. As you are using a DB chances are that IO is the

Convert back cstring to string

2023-08-22 Thread Araq
You can do it with address arithmetic, maybe. You need to know the offset (8?), subtract that from the `char*` pointer and cast it to `ptr StringDesc` (pointer) and then create a string from it, strings have a word sized length and then a payload pointer. Or something like that, I'm too lazy to

Convert back cstring to string

2023-08-22 Thread griffith1deady
try use $myCString Run

Convert back cstring to string

2023-08-22 Thread mildred
Hi, I wanted to know if it was possible to convert back a cstring to a string. Specifically, I'm binding to sqlite for user functions and when the user function returns a string, it provides a cstring as result value and a destructor callback called when the string is no longer used by sqlite i