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/>.
|
* 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"
|
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";
|
throw "Error in MS-SBVAR MEX file.\n";
|
||||||
}
|
|
||||||
|
|
||||||
# ifdef __cplusplus
|
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -17,28 +17,34 @@
|
||||||
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MEXMOD
|
#ifndef _MODIFY_FOR_MEX_H
|
||||||
#define _MEXMOD
|
#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>
|
#define dw_malloc mxMalloc
|
||||||
# include <dynblas.h>
|
#define dw_calloc mxCalloc
|
||||||
# include <dynlapack.h>
|
#define dw_realloc mxRealloc
|
||||||
|
#define dw_free mxFree
|
||||||
# define dw_malloc mxMalloc
|
#define dw_exit msExit
|
||||||
# define dw_calloc mxCalloc
|
|
||||||
# define dw_realloc mxRealloc
|
|
||||||
# define dw_free mxFree
|
|
||||||
# define dw_exit msExit
|
|
||||||
|
|
||||||
/* Handle Ctrl-C in Matlab/Octave */
|
/* Handle Ctrl-C in Matlab/Octave */
|
||||||
# ifdef MATLAB_MEX_FILE
|
#ifdef MATLAB_MEX_FILE
|
||||||
extern bool utIsInterruptPending();
|
# ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
# else
|
# else
|
||||||
# include <octave/quit.h>
|
extern
|
||||||
# endif
|
# 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
|
// NB: C23 has the [[noreturn]] attribute, so this #ifdef can be removed when
|
||||||
// we upgrade
|
// we upgrade
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -48,7 +54,4 @@ _Noreturn
|
||||||
#endif
|
#endif
|
||||||
void msExit(int status);
|
void msExit(int status);
|
||||||
|
|
||||||
extern int constant_seed;
|
#endif // _MODIFY_FOR_MEX_H
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue