From 1b317f1b9dfcab05e23e74d60f598ab3844ba100 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 30 Jan 2013 14:02:23 +0100
Subject: [PATCH] Fix linking of static file with use_dll under Windows

The "Static" symbol was not exported; instead, it was the non-existing
"Dynamic" symbol which was exported.
---
 preprocessor/ModFile.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index 32fb91dcc..b2f958077 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2012 Dynare Team
+ * Copyright (C) 2006-2013 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -560,11 +560,11 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
       if (msvc)
         // MATLAB/Windows + Microsoft Visual C++
         mOutputFile << "    eval('mex -O LINKFLAGS=\"$LINKFLAGS /export:Dynamic\" " << basename << "_dynamic.c " << basename << "_dynamic_mex.c')" << endl
-                    << "    eval('mex -O LINKFLAGS=\"$LINKFLAGS /export:Dynamic\" " << basename << "_static.c "<< basename << "_static_mex.c')" << endl;
+                    << "    eval('mex -O LINKFLAGS=\"$LINKFLAGS /export:Static\" " << basename << "_static.c "<< basename << "_static_mex.c')" << endl;
       else if (cygwin)
         // MATLAB/Windows + Cygwin g++
         mOutputFile << "    eval('mex -O PRELINK_CMDS1=\"echo EXPORTS > mex.def & echo mexFunction >> mex.def & echo Dynamic >> mex.def\" " << basename << "_dynamic.c " << basename << "_dynamic_mex.c')" << endl
-                    << "    eval('mex -O PRELINK_CMDS1=\"echo EXPORTS > mex.def & echo mexFunction >> mex.def & echo Dynamic >> mex.def\" " << basename << "_static.c "<< basename << "_static_mex.c')" << endl;
+                    << "    eval('mex -O PRELINK_CMDS1=\"echo EXPORTS > mex.def & echo mexFunction >> mex.def & echo Static >> mex.def\" " << basename << "_static.c "<< basename << "_static_mex.c')" << endl;
       else
         mOutputFile << "    error('When using the USE_DLL option, you must give either ''cygwin'' or ''msvc'' option to the ''dynare'' command')" << endl;
 #else
-- 
GitLab