From db886058b99ae281d03b209c37345344912cb037 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 24 Mar 2014 16:31:26 +0100
Subject: [PATCH] Fix call to "mex" helper under MATLAB 8.3 (R2014a) and
GNU/Linux.
There is a new LINKOPTS variable which governs the list of symbols to be
exported, so we set it to an empty value to have all symbols exported.
Previously we were overloading the LDFLAGS which was containing the list of
exported symbols.
(cherry picked from commit 9aabb82c7662205699dd8a3ca400d878835d6ab2)
---
preprocessor/ModFile.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index 94f5a1a59e..d5f4646530 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -681,8 +681,13 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
#else
# ifdef __linux__
// MATLAB/Linux
- mOutputFile << " eval('mex -O LDFLAGS=''-pthread -shared -Wl,--no-undefined'' " << basename << "_dynamic.c " << basename << "_dynamic_mex.c')" << endl
- << " eval('mex -O LDFLAGS=''-pthread -shared -Wl,--no-undefined'' " << basename << "_static.c "<< basename << "_static_mex.c')" << endl;
+ mOutputFile << " if matlab_ver_less_than('8.3')" << endl
+ << " eval('mex -O LDFLAGS=''-pthread -shared -Wl,--no-undefined'' " << basename << "_dynamic.c " << basename << "_dynamic_mex.c')" << endl
+ << " eval('mex -O LDFLAGS=''-pthread -shared -Wl,--no-undefined'' " << basename << "_static.c "<< basename << "_static_mex.c')" << endl
+ << " else" << endl
+ << " eval('mex -O LINKEXPORT='''' " << basename << "_dynamic.c " << basename << "_dynamic_mex.c')" << endl
+ << " eval('mex -O LINKEXPORT='''' " << basename << "_static.c "<< basename << "_static_mex.c')" << endl
+ << " end" << endl;
# else // MacOS
// MATLAB/MacOS
mOutputFile << " if matlab_ver_less_than('8.1')" << endl;
--
GitLab