diff --git a/REQUIRE b/REQUIRE index b9972d1..48bec86 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1,3 @@ julia 0.6 BinDeps 0.6.0 +Compat 0.48.0 diff --git a/deps/build.jl b/deps/build.jl index 2d1a976..838a42a 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -3,7 +3,7 @@ if Sys.KERNEL === :Darwin && (!success(`command -v xcode-select`) || isempty(rea "You can install them from the command line using `xcode-select --install`.") end -using BinDeps +using BinDeps, Compat.Libdl @BinDeps.setup diff --git a/src/Rmath.jl b/src/Rmath.jl index 117dcc4..49e6540 100644 --- a/src/Rmath.jl +++ b/src/Rmath.jl @@ -6,6 +6,8 @@ __precompile__() module Rmath +using Compat, Compat.Random + # use dirname(@__FILE__) instead of Pkg.dir, since the latter will # cause the package to not work if installed in some other location depsjl = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl") @@ -42,33 +44,33 @@ end function __init__() # initialize RNG hooks - unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Void}), + unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}), cfunction(rand,Float64,Tuple{})) - unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Void}), + unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}), cfunction(randn,Float64,Tuple{})) - unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Void}), - cfunction(randexp,Float64,Tuple{})) + unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}), + cfunction(Random.randexp,Float64,Tuple{})) end ## Macro for deferring freeing data until GC for wilcox and signrank macro libRmath_deferred_free(base) libcall = Symbol(base, "_free") func = Symbol(base, "_deferred_free") - quote + esc(quote let gc_tracking_obj = [] global $func function $libcall(x::Vector) gc_tracking_obj = [] - ccall(($(string(libcall)),libRmath), Void, ()) + ccall(($(string(libcall)),libRmath), Cvoid, ()) end function $func() if !isa(gc_tracking_obj, Bool) - finalizer(gc_tracking_obj, $libcall) + @compat finalizer($libcall, gc_tracking_obj) gc_tracking_obj = false end end end - end + end) end ## Non-ccall functions for distributions with 1 parameter and no defaults diff --git a/test/runtests.jl b/test/runtests.jl index 754a637..6c02460 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,6 @@ -using Base.Test -using Rmath +using Rmath, Compat, Compat.Test, Compat.Random -srand(124) +Random.srand(124) function allEq(target::Vector{Float64}, current::Vector{Float64}, tolerance::Float64) @test length(target) == length(current)