From 18c8b0d0e7e99cafd97db6dc322e2442191d2e90 Mon Sep 17 00:00:00 2001 From: Russ Tedrake Date: Sat, 1 Feb 2014 11:41:11 -0500 Subject: [PATCH] drake_debug_mex fails with a useful error when mex file tries a mexCallMATLAB. --- .gitignore | 1 + util/CMakeLists.txt | 1 + util/debugMexLib.cpp | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 33ec5b588723..ca6364ba18e8 100644 --- a/.gitignore +++ b/.gitignore @@ -117,3 +117,4 @@ solvers/test/regenSummary solvers/test/singular_solutions solvers/test/startRegen_0 solvers/test/startRegen_1 +.#* diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index b9c94dd1ceea..e9cf8af7eea0 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -9,6 +9,7 @@ add_mex(drakeUtil SHARED drakeUtil.cpp) pods_install_libraries(drakeUtil) add_mex(debugMex SHARED debugMexLib.cpp) +#set_property( SOURCE debugMexLib.cpp PROPERTY COMPILE_FLAGS -DMX_COMPAT_32 ) add_mex(drake_debug_mex EXECUTABLE drakeDebugMex.cpp) if (eigen3_FOUND) diff --git a/util/debugMexLib.cpp b/util/debugMexLib.cpp index be0b95899737..9d0333c4760f 100644 --- a/util/debugMexLib.cpp +++ b/util/debugMexLib.cpp @@ -5,13 +5,29 @@ * Author: russt */ +#include #include #include +using namespace std; mxArray *mxGetProperty(const mxArray *pa, mwIndex index, const char *propname) { - return mxGetField(pa,index,propname); + return mxGetField(pa,index,propname); } +extern "C" { +int mexCallMATLAB(int nlhs, mxArray *plhs[], int nrhs, + mxArray *prhs[], const char *functionName) +{ + cerr << "Invalid mex file: Calls to mexCallMATLAB are not supported by drake_debug_mex" << endl; + return 0;; +} + +mxArray *mexCallMATLABWithTrap(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[], const char *functionName) +{ + cerr << "Invalid mex file: Calls to mexCallMATLAB are not supported by drake_debug_mex" << endl; + return NULL; +} +}