Initialize a library of MATLAB functions packaged in a deployable archive file
std::unique_ptr<MATLABLibrary>
initMATLABLibrary(std::shared_ptr<MATLABApplication> application, const
std::u16string & ctfPath)
Initialize a library of MATLAB® functions packaged in a deployable archive (CTF) file, and return a unique
pointer to the library. As parameters, it takes a shared pointer to a
MATLABApplication
instance and a path to the CTF.
The path to the deployable archive is either relative or absolute. If the path is relative, the following paths are prepended in the order specified below until the file is found or all possibilities are exhausted.
the value of the environment variable
CPPSHARED_BASE_CTF_PATH
, if defined
the working folder
the folder where the executable is located
on Mac: the folder three levels above the folder where the executable
is located (for example, if the executable is
generic_interface/foo_generic.app/Contents/MacOS/foo
,
the folder used is generic_interface
)
If the library is found, it is initialized and a pointer to it is returned. Otherwise,an exception is thrown.
std::shared_ptr<MATLABApplication>
application | Pointer to a |
const std::u16string & ctfPath | Path (relative or absolute) to archive. |
| Pointer to a |
| No library with the given name is found on the shared library path. |
matlab::cpplib::LibInitErr | Library cannot be initialized. |
MATLABLibrary
std::vector<std::u16string> opts = {u"-nojvm"}; auto matlabPtr = initMATLABApplication(MATLABApplicationMode::IN_PROCESS, opts); auto libAstro = initMATLABLibrary(matlabPtr, convertUTF8StringToUTF16String("astro.ctf"));
matlab::cpplib::convertUTF16StringToUTF8String
| matlab::cpplib::convertUTF8StringToUTF16String
| matlab::cpplib::initMATLABApplication
| matlab::cpplib::initMATLABLibraryAsync
| matlab::cpplib::MATLABLibrary::feval
| matlab::cpplib::MATLABLibrary::fevalAsync
| matlab::cpplib::MATLABLibrary::waitForFiguresToClose
| matlab::cpplib::runMain