I have wrapped a C function with the following signature:
    
    
    type
      VSAPI*  {.bycopy.} = object
        ...
        propSetIntArray*: proc(map:ptr VSMap, key:cstring, i:ptr int64, 
size:cint):cint
        ...
    
    Run

I want to make easier to deal with it with something like the following:
    
    
    proc propSetIntArray(vsmap:ptr VSMap, key:string, arr:seq[int]) =
      let p = cast[ptr int64](unsafeAddr(arr))
      let ret = API.propSetIntArray(vsmap, key.cstring, p, arr.len.cint)
      if ret == 1:
        raise newException(ValueError, "Size is negative")
    
    Run

This is not working. I am getting (probably the addresses):
    
    
    integers: @[94379288560544, 94379288560512, 94379297070336]

instead of:
    
    
    integers: @[1, 3, 5]

Reply via email to