That is interesting.

From

[https://nim-lang.org/docs/manual.html#types-cstring-type](https://nim-lang.org/docs/manual.html#types-cstring-type)

we have

> One can use the builtin procs GC_ref and GC_unref to keep the string data 
> alive

So manual is not clear enough.

You may still allocate unmanaged memory with procs like create() or alloc() and 
copy the string content with copyMem(). I can not give you example code, I 
never did that.

Or you may try to use a ref string data type:
    
    
    type
      M = ref string
    
    proc main =
      
      var s = new M
      
      s[] = "Hello"
      echo s[]
    
    main()
    
    
    Run

But let us wait for mratsim or Araq. 

Reply via email to