From a8b7bd31c58f3afe4f35b90fe56f0ae8509efaea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 20 Jan 2020 18:33:31 +0100
Subject: [PATCH] Fix bug introduced in use_dll mode in
 23a08a36628f19eee82eb713240bb8ca64be04e3

Ref. #40
---
 src/DynamicModel.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 5168145b..1b38a87d 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -1780,7 +1780,7 @@ DynamicModel::writeDynamicCFile(const string &basename) const
                   << "void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])" << endl
                   << "{" << endl
                   << "  /* Check that no derivatives of higher order than computed are being requested */" << endl
-                  << "  if (nlhs > " << computed_derivs_order << ")" << endl
+                  << "  if (nlhs > " << computed_derivs_order + 1 << ")" << endl
                   << R"(    mexErrMsgTxt("Derivatives of higher order than computed have been requested");)" << endl
                   << "  /* Create a pointer to the input matrix y. */" << endl
                   << "  double *y = mxGetPr(prhs[0]);" << endl
-- 
GitLab