matlab::cpplib::initMATLABLibraryAsync
MATLAB 関数のライブラリを非同期で初期化
説明
FutureResult<std::shared_ptr<MATLABLib>> initMATLABLibraryAsync(MATLABApplication & application, const std::u16string & ctfPath)
FutureResult<std::shared_ptr<MATLABLib>> initMATLABLibraryAsync(MATLABApplication & application, const std::u16string & ctfPath, const std::u16string& session_key = std::u16string())
MATLAB® 関数のライブラリを非同期で初期化して、初期化の完了後に初期化されたばかりの C++ 共有ライブラリへのポインターを取得します。
オプションで、16 進数でエンコードされた 64 バイトの AES 復号化キーの引数を追加指定できます。これを使用すると、実行時に MEX ローダーの代わりに C++ API を使用してライブラリを復号化できます。
パラメーター
MATLABApplication & application |
|
const std::u16string & ctfPath | ライブラリの名前。パスが省略された場合、現在のフォルダー内にあると仮定されます。 |
const std::u16string& session_key = std::u16string() | AES 復号化キー。64 バイトのファイル サイズの 16 進数でエンコードされた AES キーとして指定します。 詳細については、 |
戻り値
|
|
例外
| 指定された名前のライブラリが共有ライブラリ パスに見つかりません。 |
matlab::cpplib::LibInitErr | ライブラリを初期化できません。 |
例
MATLABLibrary を非同期で初期化し、この初期化が完了するまで待機する
auto future = mc::initMatlabLibraryAsync(matlabApplication,
mc::convertUTF8StringToUTF16String("libdoubleasync.ctf"));
if (!future.valid()) {
throw std::future_error(std::future_errc::no_state);
}
std::future_status status;
do {
status = future.wait_for(std::chrono::milliseconds(200));
if (status == std::future_status::timeout) {
std::cout << "Library initialization is in progress.\n";
} else if (status == std::future_status::ready) {
std::cout << "Library initialization has completed.\n";
}
std::this_thread::sleep_for(std::chrono::seconds(1));
} while (status != std::future_status::ready);
auto lib = future.get();
バージョン履歴
R2018a で導入
参考
matlab::cpplib::convertUTF8StringToUTF16String | matlab::cpplib::convertUTF16StringToUTF8String | matlab::cpplib::initMATLABApplication | matlab::cpplib::runMain | matlab::cpplib::initMATLABLibrary | matlab::cpplib::MATLABLibrary::feval | matlab::cpplib::MATLABLibrary::fevalAsync | matlab::cpplib::MATLABLibrary::waitForFiguresToClose