Glad to help!

> update: FIXED: it required NULL-terminated array what could be the best way 
> to pass pointer of cstrings/strings array

There's a helper in the stdlib type for arrays of C strings: 
<https://nim-lang.org/docs/system.html#cstringArray>

If you look in the system module there's other helpers for C string arrays 
like: <https://nim-lang.org/docs/system.html#cstringArrayToSeq%2CcstringArray>

> but I cannot return it from the function. I can cast of course, but not sure 
> is it good way or not

Yah, coming from a C background it tripped me up at first as well. 
`UncheckedArray[T]` represents the actual array in Nim not the array pointer.

So you need `ptr UncheckedArray[T]` to emulate a C pointer array, e.g. an array 
of ints in C would become `ptr UncheckedArray[int]` in Nim.

I kept thinking of it as an alias for `int *a` but it's not. So to get an 
`int**` you'd need:
    
    
    var x: ptr UncheckedArray[cstring]
    f(x.addr) ## this makes a `ptr ptr array[cstring]` basically
    
    
    Run

Reply via email to