Main Content

mwArray API を使用した C++ アプリケーションへのデプロイ

データ交換用の MATLAB® API を使用して、パッケージ化された mwArray 関数を C++ アプリケーションに統合する

この方法では、デプロイする MATLAB 関数から C++ 共有ライブラリおよびヘッダー ファイルを作成します。C++ アプリケーションとデプロイされた MATLAB 関数とのインターフェイスとして C++ 用のレガシ MATLAB Compiler SDK™ API を使用します。mwArray API を使用して、C++ アプリケーションとデプロイされた MATLAB 関数間のデータ交換を処理します。デプロイされた MATLAB 関数を C++ コード内でメンバー関数として使用可能にするには、プリプロセッサ命令を使用して C++ アプリケーションに生成済みのヘッダー ファイルを組み込む必要があります。デプロイされた MATLAB 関数で使用される MATLAB Runtime インスタンスのライフサイクルを明示的に管理する必要があります。Runtime インスタンスは、C++ アプリケーションでインプロセスでのみ実行できます。デプロイされた MATLAB 関数は同期的にのみ実行できます。

C++ mwArray API は C++03 の機能のみをサポートします。mwArray API を使用する C++ 共有ライブラリのインターフェイスは、C スタイルの関数を使用して MATLAB Runtime の初期化、パッケージ化された MATLAB 関数の MATLAB Runtime への読み込み、および C++ ドライバー コードと MATLAB Runtime の間で渡されるデータの管理を行います。これらの関数は C/C++ API で説明されています。C++ mwArray API の下にリストされている関数は mwArray API に固有であり、他の API 用に作成された共有ライブラリには使用できません。

関数

compiler.build.cppSharedLibraryC++ 共有ライブラリの作成
compiler.build.CppSharedLibraryOptionsC++ 共有ライブラリのビルド オプション
mbuildMATLAB の生成された共有ライブラリに対してソース ファイルをコンパイルおよびリンクする

C/C++ API

mclmcrInitializeMATLAB Runtime プロキシ ライブラリの初期化
mclInitializeApplication現在のプロセスで作成されたすべての MATLAB Runtime インスタンスによって共有されるアプリケーション状態の設定
mclTerminateApplicationMATLAB Runtime 内部アプリケーション状態を閉じる
<library>Initialize[WithHandlers]Initialize MATLAB Runtime instance associated with library
<library>Terminatelibrary に関連付けられている MATLAB Runtime インスタンスによって割り当てられているリソースをすべて解放する
mclRunMainMechanism for creating identical wrapper code across all platforms
mclIsMCRInitializedDetermine if MATLAB Runtime has been properly initialized
mclWaitForFiguresToDieEnable deployed applications to process graphics events so that figure windows remain displayed
mclGetLastErrorMessageLast error message from unsuccessful library initialization or MATLAB function call
mclGetLogFileNameRetrieve name of log file used by MATLAB Runtime
mclIsJVMEnabledDetermine if MATLAB Runtime was started with instance of Java Virtual Machine (JVM)
mclIsNoDisplaySet-nodisplay モードが有効かどうかを判定

C++ mwArray API

mwArrayClass used to pass input/output arguments to C++ functions generated by MATLAB Compiler SDK
mwExceptionException type used by the mwArray API and the C++ interface functions
mwStringString class used by the mwArray API to pass string data as output from certain methods

トピック

要件

C++ mwArray API 共有ライブラリの作成

C++ 共有ライブラリと C++ アプリケーションの統合

Mac OS X

保守

  • メモリの管理およびクリーンアップ
    メモリ管理の推奨について説明する。
  • Understand the mclmcrrt Proxy Layer
    All application and software components generated by MATLAB Compiler™ and MATLAB Compiler SDK need to link against only one MATLAB library, mclmcrrt. This library provides a proxy API for all the public functions in MATLAB libraries used for matrix operations, MAT-file access, utility and memory management, and application MATLAB Runtime. The mclmcrrt library lies between deployed MATLAB code and these other version-dependent libraries, providing the following functionality:
  • Compilation Failures
    List of possible failures during compilation.
  • Testing Failures
    List of possible failures during testing.
  • Deployment Failures
    List of possible failures during deployment.