ccall doesn't really care about what type you send in, it'll clean up any mismatches there. but it really, really cares about what type is expected by the c/fortran library, since small mismatches there can corrupt or crash the program.
On Wed, Apr 22, 2015 at 11:55 AM Kristoffer Carlsson <[email protected]> wrote: > Hmm, well I don't know what format ccall wants the type in if I will send > a vector. > > Maybe it doesn't matter in practice what is used: > > julia> a = [1.0,2.0,3.0] > 3-element Array{Float64,1}: > 1.0 > 2.0 > 3.0 > > julia> convert(Ptr{eltype(a)}, pointer(a)) > Ptr{Float64} @0x00007f3b89632980 > > julia> convert(Ptr{typeof(a)}, pointer(a)) > Ptr{Array{Float64,1}} @0x00007f3b89632980 > > > > On Wednesday, April 22, 2015 at 5:51:01 PM UTC+2, Jameson wrote: > >> Ptr{Vector{Float64}} is a weird type to pass to Fortran. Did you mean >> Ptr{Float64} perhaps? >> >> On Wed, Apr 22, 2015 at 11:40 AM Kristoffer Carlsson <[email protected]> >> wrote: >> >>> Hello everyone, >>> >>> I call a fortran function in a way similar to this: >>> >>> ccall(fortran_func, Void, (Ref{Int}, Ptr{Vector{Float64}}), 5, para) >>> >>> I then get the following deprecation warning each time I call it: >>> >>> WARNING: convert(::Type{Ptr}, ::Array{Float64,1}) methods should be >>> converted to be methods of unsafe_convert >>> >>> This deprecation warning basically takes all the time in my analysis. >>> I read this: https://github.com/JuliaLang/julia/issues/10437 but I am >>> not sure what I actually need to do to make it go away. >>> Running juilia --depwarn=no does not help. >>> >>> Thanks in advance, >>> >>> // Kristoffer Carlsson >>> >>
