diff --git a/src/NLopt.jl b/src/NLopt.jl index 710059e..bc699c5 100644 --- a/src/NLopt.jl +++ b/src/NLopt.jl @@ -800,16 +800,6 @@ function optimize(o::Opt, x::AbstractVector{<:Real}) return optimize!(o, copyto!(Array{Cdouble}(undef, length(x)), x)) end -@static if !isdefined(Base, :get_extension) - include("../ext/NLoptMathOptInterfaceExt.jl") - using .NLoptMathOptInterfaceExt - const Optimizer = NLoptMathOptInterfaceExt.Optimizer -else - # declare this upfront so that the MathOptInterface extension can assign it - # without creating a new global - global Optimizer -end - export Opt, NLOPT_VERSION, algorithm, @@ -853,4 +843,14 @@ export Opt, Algorithm, Result +@static if !isdefined(Base, :get_extension) + include("../ext/NLoptMathOptInterfaceExt.jl") + using .NLoptMathOptInterfaceExt + const Optimizer = NLoptMathOptInterfaceExt.Optimizer +else + # declare this upfront so that the MathOptInterface extension can assign it + # without creating a new global + global Optimizer +end + end # module