Skip to content

Commit c649f42

Browse files
dmbatesararslan
authored andcommitted
cfunction => at-cfunction (#52)
1 parent 3435e1f commit c649f42

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/Rmath.jl

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,26 @@ end
4242
export dwilcox,pwilcox,qwilcox,rwilcox # Wilcox's Rank Sum statistic (m, n)
4343
export ptukey, qtukey # Studentized Range Distribution - p and q only
4444

45-
function __init__()
46-
# initialize RNG hooks
47-
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
48-
cfunction(rand,Float64,Tuple{}))
49-
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
50-
cfunction(randn,Float64,Tuple{}))
51-
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
52-
cfunction(Random.randexp,Float64,Tuple{}))
45+
@static if VERSION v"0.7.0-DEV.4749"
46+
function __init__()
47+
# initialize RNG hooks
48+
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
49+
@cfunction(rand,Float64,()))
50+
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
51+
@cfunction(randn,Float64,()))
52+
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
53+
@cfunction(Random.randexp,Float64,()))
54+
end
55+
else
56+
function __init__()
57+
# initialize RNG hooks
58+
unsafe_store!(cglobal((:unif_rand_ptr,libRmath),Ptr{Cvoid}),
59+
cfunction(rand,Float64,Tuple{}))
60+
unsafe_store!(cglobal((:norm_rand_ptr,libRmath),Ptr{Cvoid}),
61+
cfunction(randn,Float64,Tuple{}))
62+
unsafe_store!(cglobal((:exp_rand_ptr,libRmath),Ptr{Cvoid}),
63+
cfunction(Random.randexp,Float64,Tuple{}))
64+
end
5365
end
5466

5567
## Macro for deferring freeing data until GC for wilcox and signrank

0 commit comments

Comments
 (0)