@@ -6,12 +6,30 @@ using Reexport
66@reexport using CUDACore
77
88# Forward public names from CUDACore so CUDA.xyz works (exported names handled by @reexport)
9- for n in names (CUDACore)
10- Base. isexported (CUDACore, n) && continue
11- n === :CUDACore && continue
12- isdefined (CUDACore, n) || continue
13- @eval using CUDACore: $ n
14- @eval $ (Expr (:public , n))
9+ if VERSION >= v " 1.11.0-DEV.469"
10+ # On 1.11+, `names` returns public names, so we can forward just those
11+ for n in names (CUDACore)
12+ Base. isexported (CUDACore, n) && continue
13+ n === :CUDACore && continue
14+ isdefined (CUDACore, n) || continue
15+ @eval using CUDACore: $ n
16+ @eval $ (Expr (:public , n))
17+ end
18+ else
19+ # On 1.10, there's no `public` keyword. Use PUBLIC_NAMES for names registered
20+ # by @public, and scan names(; all=true) for public enum values created by
21+ # @enum_without_prefix (which bypasses @public but creates const bindings).
22+ public_names = Set {Symbol} (CUDACore. PUBLIC_NAMES)
23+ for n in names (CUDACore; all= true )
24+ isdefined (CUDACore, n) || continue
25+ val = try getfield (CUDACore, n) catch ; continue end
26+ val isa CUDACore. CEnum. Cenum && Symbol (val) != = n && push! (public_names, n)
27+ end
28+ for n in public_names
29+ Base. isexported (CUDACore, n) && continue
30+ isdefined (CUDACore, n) || continue
31+ @eval using CUDACore: $ n
32+ end
1533end
1634
1735# Load math libraries so their methods (matmul, rand, etc.) are available
0 commit comments