matlab::cpplib::initMATLABLibraryAsync
Initialize a library of MATLAB function asynchronously
Description
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())
Initialize a library of MATLAB® function asynchronously to obtain a pointer to a freshly initialized C++ shared library once initialization is complete.
Optionally, you can specify the additional argument of a hex encoded 64 byte AES decryption key, which allows you to decrypt the library at runtime using the C++ API rather than a MEX loader.
Parameters
MATLABApplication & application | MATLAB Application object returned from
|
const std::u16string & ctfPath | Name of library. If path is omitted, it is assumed to be in the
current folder. For information on how to use
|
const std::u16string& session_key =
std::u16string() | AES decryption key, specified as a hex encoded AES key with a 64 byte file size. For more details, see |
Return Value
| A |
Exceptions
| No library with the given name found on the shared library path. |
matlab::cpplib::LibInitErr | Library cannot be initialized. |
Examples
Initialize MATLABLibrary
Asynchronously, and Wait Until It Initializes
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();
Version History
Introduced in R2018a
See Also
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