How to determine MEX API version?

1 回表示 (過去 30 日間)
Alain BARTHE
Alain BARTHE 2016 年 3 月 17 日
コメント済み: James Tursa 2018 年 11 月 8 日
I have written some years ago a C shared library to use with Matlab.
I was using the MX_API_VER preprocessor macro to detect MEX API version,
#include "mex.h"
#include "matrix.h"
#if (! defined MX_API_VER) || (MX_API_VER < 0x07030000)
/*
* Compatibiliy with older version of MATLAB
*/
typedef int mwSize;
typedef int mwIndex;
#endif
Unfortunately, it seems that the MX_API_VER has disappeared from matrix.h in Matlab 2016a.
Is there another way to detect MAX API version ?
Regards.

採用された回答

James Tursa
James Tursa 2016 年 3 月 17 日
I have a complicated macro to detect API version at compile time that I could post, but if you are only trying to deal with the mwSize and mwIndex stuff you can check for MWSIZE_MAX. E.g.,
#ifndef MWSIZE_MAX
#define mwIndex int
#define mwSignedIndex int
#define mwSize int
#endif
  2 件のコメント
Alain BARTHE
Alain BARTHE 2016 年 3 月 17 日
I think your solution will be sufficient for my usage.
However, I was surprised to see that the following has disappeared from the matrix.h, when upgrading to 2016a.
#define MX_API_VER 0x7nnnnnnn
Many thanks for your quick answer.
James Tursa
James Tursa 2018 年 11 月 8 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by