From deaf8f9455547dad68619868b6c1d1d0f431a6f3 Mon Sep 17 00:00:00 2001 From: Davis King Date: Tue, 8 Mar 2016 15:18:19 -0500 Subject: [PATCH] Made DLIB_ASSERT and DLIB_CASSERT not kill the process when running inside a MATLAB mex file. --- dlib/error.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlib/error.h b/dlib/error.h index 3431ca8c3..6b70ae0f7 100644 --- a/dlib/error.h +++ b/dlib/error.h @@ -254,6 +254,15 @@ namespace dlib void check_for_previous_fatal_errors() { + // If dlib is being use to create plugins for some other application, like + // MATLAB, then don't do these checks since it terminates the over arching + // system. Just let the errors go to the plugin handler and it will deal with + // them. +#if defined(MATLAB_MEX_FILE) + return; +#endif + + static bool is_first_fatal_error = true; if (is_first_fatal_error == false) {