@griffith1deady is right, `ptr UncheckedArray` is the way to go. What this means is basically just that Nim won't make any bounds checks to see if access to this array is valid or not. This is similar to C where, even given a strict definition as above, array access is purely a runtime error. Also the declaration `const uint8_t some_array[303530]` basically just means that 303530 elements of `uint8_t` size should be allocated on the stack, and `some_array` holds a pointer to this array (which is the same as a pointer to the first element in C). So your examples become: let some_array_size: cint {.importc.} let some_array: ptr UncheckedArray[uint8] {.importc.} proc some_func(buf: ptr UncheckedArray [uint8], buf_len: cint) {.importc, header: "some_library.h".} some_func(some_array, some_array_size) Run
Unfortunately there is no way to express the `const` modifier properly in Nim, but you'll get errors from the C compiler if you violate this constraint. Of course I'd always recommend using automatic wrapping with Futhark where possible. Although if you don't have a header (??) it might get tricky. You could of course write a valid header file yourself.