Skip to content

Commit

Permalink
Workaround to prevent double initialization of CUTEst
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira committed Feb 16, 2015
1 parent 9c0a807 commit 6412f63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/CUTEst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type CUTEstModel
initialized :: Bool;
end

global csetup_calls = 0

cint(n) = convert(Cint, n)
cdouble(n) = convert(Cdouble, n)

Expand Down Expand Up @@ -63,6 +65,10 @@ end

# Initialize problem.
function CUTEstModel(name :: ASCIIString; raw :: Bool = false)
@eval csetup_calls += 1;
if csetup_calls > 1
throw("CUTEst cannot be initialized a second time. See https://github.com/optimizers/CUTEst.jl/issues/4.")
end
libname = sifdecoder(name, raw=raw)
io_err = Cint[0];

Expand Down

0 comments on commit 6412f63

Please sign in to comment.