Skip to content

Commit d9463d6

Browse files
authored
use invokelatest to access bindings generated with Core.eval (#468)
to fix warnings (future errors) on nightly
1 parent c7d6119 commit d9463d6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/CxxWrap.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,17 +766,19 @@ end
766766

767767
# Wrap functions from the cpp module to the passed julia module
768768
function wrap_functions(functions, julia_mod)
769-
if !isempty(julia_mod.__cxxwrap_pointers)
770-
empty!(julia_mod.__cxxwrap_methodkeys)
771-
empty!(julia_mod.__cxxwrap_pointers)
769+
cxxp = Base.invokelatest(getproperty, julia_mod, :__cxxwrap_pointers)
770+
cxxmk = Base.invokelatest(getproperty, julia_mod, :__cxxwrap_methodkeys)
771+
if !isempty(cxxp)
772+
empty!(cxxmk)
773+
empty!(cxxp)
772774
end
773775
precompiling = true
774776

775777
for func in functions
776778
(mkey,fptrs) = _register_function_pointers(func, precompiling)
777-
push!(julia_mod.__cxxwrap_methodkeys, mkey)
778-
push!(julia_mod.__cxxwrap_pointers, fptrs)
779-
funcidx = length(julia_mod.__cxxwrap_pointers)
779+
push!(cxxmk, mkey)
780+
push!(cxxp, fptrs)
781+
funcidx = length(cxxp)
780782

781783
Core.eval(julia_mod, build_function_expression(func, funcidx, julia_mod))
782784
end

0 commit comments

Comments
 (0)