We already have this in Nim.

We have ptr in Nim. This is a raw C pointer. The GC does not track it. ref is a 
GC tracked pointer.

you can use gc_ref and gc_unref to convert between the two freely: 
[https://nim-lang.org/docs/system.html#GC_ref%2Cref.T](https://nim-lang.org/docs/system.html#GC_ref%2Cref.T)

Here is an example of working with the C FFI using cstrings from the manual: 
[https://nim-lang.org/docs/manual.html#types-cstring-type](https://nim-lang.org/docs/manual.html#types-cstring-type)

It works similarly for other types.

Reply via email to