Skip to content

Commit

Permalink
cfunction => at-cfunction (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbates authored and ararslan committed May 18, 2018
1 parent 3435e1f commit c649f42
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/Rmath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,26 @@ end
export dwilcox,pwilcox,qwilcox,rwilcox # Wilcox's Rank Sum statistic (m, n)
export ptukey, qtukey # Studentized Range Distribution - p and q only

function __init__()
# initialize RNG hooks
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(rand,Float64,Tuple{}))
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(randn,Float64,Tuple{}))
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(Random.randexp,Float64,Tuple{}))
@static if VERSION v"0.7.0-DEV.4749"
function __init__()
# initialize RNG hooks
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
@cfunction(rand,Float64,()))
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
@cfunction(randn,Float64,()))
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
@cfunction(Random.randexp,Float64,()))
end
else
function __init__()
# initialize RNG hooks
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(rand,Float64,Tuple{}))
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(randn,Float64,Tuple{}))
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
cfunction(Random.randexp,Float64,Tuple{}))
end
end

## Macro for deferring freeing data until GC for wilcox and signrank
Expand Down

0 comments on commit c649f42

Please sign in to comment.