If you need the pointers to each lower-dimensional slice, you should be able to build it like so (warning: untested):
``` sz = size(A)[2:end] # if you need type-stability, use Base.tail(size(A)) instead Aptrs = Array{Ptr{eltype(A)}(sz) for I in CartesianRange(sz) Aptrs[I] = pointer(A, sub2ind(size(A), 1, I.I...)) end ``` and then pass Aptrs to your C function. Note that A must be an Array (not a generic AbstractArray) for this to work. Best, --Tim On Fri, Nov 4, 2016 at 9:05 AM, Yichao Yu <yyc1...@gmail.com> wrote: > On Fri, Nov 4, 2016 at 9:22 AM, Alexander Lyapin > <lyapinaalexan...@gmail.com> wrote: > > There is a topic: > > https://groups.google.com/d/msg/julia-users/EK9oNzzaoAk/kJqagPL0Ku0J > > > > However could some one give an example how to pass 3-d or 4-d array to C > > function. > > > > I have Array{Float64, 4} and for ccall I use Ptr{Ptr{Ptr{Ptr{Float64}}}} > as > > Type of parameter. Is there some way to make it more common for > > Array{Float64, N}??? Thank you > > No matter what the dimension is,it's always a `Ptr{eltype(array)}` in > C (`Ptr{Float64}` in thiscase) and since it's just a normalpointer, > you always need topass the dimensions explicitlyto C in another > argumetns. >