The best way to allocate cstrings in Nim is to do
    
    
    var a = newString(len)
    someProcThatTakesCstr(a.cstring, a.len)
    
    
    Run

> when passing the cStringArray (in earlier call glShaderSource), I need to 
> pass the size of that array. I know it is 1 so I hard code it, but is there a 
> way to get the size from the cStringArray?

I'd suggest not heap allocating a cstringarray and just using a stack array 
with a cast as such 
<https://github.com/beef331/truss3d/blob/master/src/truss3D/shaders.nim#L39-L43>

Reply via email to