MS-SBVAR MEX: fixes related to C linkage (extern "C")
Also fix or remove various #ifdefs, and remove unused “int constant_seed”.kalman-mex
parent
4a68cfcbd6
commit
4f1e5e1bc2
|
@ -17,25 +17,12 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
||||
#include <dynmex.h>
|
||||
|
||||
# include <dynmex.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
[[noreturn]]
|
||||
void
|
||||
msExit([[maybe_unused]] int status)
|
||||
{
|
||||
# endif
|
||||
|
||||
int constant_seed;
|
||||
|
||||
[[noreturn]]
|
||||
void
|
||||
msExit([[maybe_unused]] int status)
|
||||
{
|
||||
throw "Error in MS-SBVAR MEX file.\n";
|
||||
}
|
||||
|
||||
# ifdef __cplusplus
|
||||
throw "Error in MS-SBVAR MEX file.\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -17,28 +17,34 @@
|
|||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MEXMOD
|
||||
#define _MEXMOD
|
||||
#ifndef _MODIFY_FOR_MEX_H
|
||||
#define _MODIFY_FOR_MEX_H
|
||||
|
||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
||||
#include <dynmex.h>
|
||||
#include <dynblas.h>
|
||||
#include <dynlapack.h>
|
||||
|
||||
# include <dynmex.h>
|
||||
# include <dynblas.h>
|
||||
# include <dynlapack.h>
|
||||
|
||||
# define dw_malloc mxMalloc
|
||||
# define dw_calloc mxCalloc
|
||||
# define dw_realloc mxRealloc
|
||||
# define dw_free mxFree
|
||||
# define dw_exit msExit
|
||||
#define dw_malloc mxMalloc
|
||||
#define dw_calloc mxCalloc
|
||||
#define dw_realloc mxRealloc
|
||||
#define dw_free mxFree
|
||||
#define dw_exit msExit
|
||||
|
||||
/* Handle Ctrl-C in Matlab/Octave */
|
||||
# ifdef MATLAB_MEX_FILE
|
||||
extern bool utIsInterruptPending();
|
||||
#ifdef MATLAB_MEX_FILE
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# else
|
||||
# include <octave/quit.h>
|
||||
extern
|
||||
# endif
|
||||
bool utIsInterruptPending();
|
||||
#else
|
||||
# include <octave/quit.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
// NB: C23 has the [[noreturn]] attribute, so this #ifdef can be removed when
|
||||
// we upgrade
|
||||
#ifdef __cplusplus
|
||||
|
@ -48,7 +54,4 @@ _Noreturn
|
|||
#endif
|
||||
void msExit(int status);
|
||||
|
||||
extern int constant_seed;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif // _MODIFY_FOR_MEX_H
|
||||
|
|
Loading…
Reference in New Issue