matlab::cpplib::initMATLABLibraryAsync
Initialize a library of MATLAB function asynchronously
Description
FutureResult<std::shared_ptr<MATLABLib>>
initMATLABLibraryAsync(MATLABApplication & application, const std::u16string
& ctfPath)
Initialize a library of MATLAB® function asynchronously, to obtain a pointer to a freshly initialized C++ shared library once initialization is complete.
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
|
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