I'm not sure if I'm fit to improve the docs because I'm not good enough with
nim's internal things and not good with english either. Maybe I'll try when I
become better with either of them ;)
You're welcome. Nim core devs are **_very_** willing to work with any and all
comers on pull requests to improve documentation. Ignorance by otherwise
reasonably patient and resourceful newcomers is **_not_** easy to simulate (in
any project, really). In some ways it's a resource that decays wit
Thank you!
I wish the docs had mentioned this -
[https://nim-lang.org/docs/backends.html](https://nim-lang.org/docs/backends.html)
Nim defines a
proc allocCStringArray*(a: openArray[string]): cstringArray
Run
in the `system` module (no need to explicitly `import` it). There is also a
corresponding:
proc deallocCStringArray*(a: cstringArray)
Run
You probably want to u
Corrected:
proc kget*(elems: seq[string]): string =
var arr: CArray[cstring]
arr[0] = "start"
var i = 1
for elem in elems:
arr[i] = elem
i += 1
var size: cint = cast[cint](elems.len() + 1)
return $fn(size, addr arr)# tried it wi
When I load the array manually, it works(somewhat):
var arr: CArray[cstring]
arr[0] = "start"
arr[1] = "arg1"
arr[2] = "arg2"
arr[3] = "arg3"
arr[4] = "arg4"
echo $fn(5, unsafeAddr arr)
Run
the C library works _correctly_ and the logs show good r
Hi
> How to create and pass an array of string to nim and pass it to C?
type CArray{.unchecked.}[T] = array[0..0, T]#found it on the forum
proc fn(argc: cint, args: ptr CArray[cstring]): cstring {.importc, dynlib:
"...".}
Run
I tried this but got *** stack sm