When the function you are calling is void you should use Void as the return
type instead of the first (Int, Ptr{Float64},Ptr{Float64}), i.e.
ccall( (:cc, "sparselib"), Void, (Int, Ptr{Float64},Ptr{Float64}),n,x,w)
Med venlig hilsen
Andreas Noack
2014-09-02 9:04 GMT-04:00 Alan Crawford <[email protected]>:
> hi!
>
> i'm trying to use ccall in the following example:
>
> julia> x = zeros(10)
> 10-element Array{Float64,1}:
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
>
> julia> w = zeros(10)
> 10-element Array{Float64,1}:
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.0
>
> julia> n = 4
> 4
> julia> ccall( (:cc, "sparselib"), (Int, Ptr{Float64},Ptr{Float64}), (Int,
> Ptr{Float64},Ptr{Float64}),n,x,w)
> ERROR: error compiling anonymous: in anonymous: ccall: missing return type
>
> the calling interface of the cc function is
>
> void cc ( int n, double x[], double w[] )
>
> ie it returns nothing.
>
> i compiled this library and it seems to work:
>
> julia> ccall( (:cpu_time, "sparselib"), Int32, ())
>
> 2395765
>
> thanks!
>
>
>
>