perfect_foresight_problem MEX: fix compilation under Windows

time-shift
Sébastien Villemot 2019-06-25 11:13:48 +02:00
parent 7e274d8234
commit 7347554db5
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 17 additions and 9 deletions

View File

@ -17,15 +17,6 @@
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(_WIN32) || defined(__CYGWIN32__)
# ifndef NOMINMAX
# define NOMINMAX // Do not define "min" and "max" macros
# endif
# include <windows.h>
#else
# include <dlfcn.h> // unix/linux DLL (.so) handling routines
#endif
#include <dynmex.h>
#include "DynamicModelCaller.hh"
@ -34,7 +25,11 @@
std::string DynamicModelCaller::error_msg;
#if defined(_WIN32) || defined(__CYGWIN32__)
HINSTANCE DynamicModelDllCaller::dynamic_mex{nullptr};
#else
void *DynamicModelDllCaller::dynamic_mex{nullptr};
#endif
DynamicModelDllCaller::dynamic_tt_fct DynamicModelDllCaller::residual_tt_fct{nullptr}, DynamicModelDllCaller::g1_tt_fct{nullptr};
DynamicModelDllCaller::dynamic_deriv_fct DynamicModelDllCaller::residual_fct{nullptr}, DynamicModelDllCaller::g1_fct{nullptr};

View File

@ -21,6 +21,15 @@
#include <memory>
#include <limits>
#if defined(_WIN32) || defined(__CYGWIN32__)
# ifndef NOMINMAX
# define NOMINMAX // Do not define "min" and "max" macros
# endif
# include <windows.h>
#else
# include <dlfcn.h> // unix/linux DLL (.so) handling routines
#endif
class DynamicModelCaller
{
public:
@ -39,7 +48,11 @@ public:
class DynamicModelDllCaller : public DynamicModelCaller
{
private:
#if defined(_WIN32) || defined(__CYGWIN32__)
static HINSTANCE dynamic_mex;
#else
static void *dynamic_mex;
#endif
using dynamic_tt_fct = void (*)(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, double *T);
using dynamic_deriv_fct = void (*) (const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, const double *T, double *deriv);
static dynamic_tt_fct residual_tt_fct, g1_tt_fct;