Load C++ Library In-Process or Out-of-Process
Load Out-of-Process C++ Library
MATLAB® can run C++ functions in a separate process. Running in a separate process enables you to:
Use some third-party libraries in the code that conflict with MATLAB.
Publishers can use this mode while developing an interface, eliminating the need to restart MATLAB while testing.
Isolate the MATLAB process from crashes in the C++ library code.
To run out-of-process, in your workflow script created by the
clibPublishInterfaceWorkflow function, run the Enable out-of-process
execution mode section. Alternatively, from the command line, call the
clibConfiguration function with the
argument set to
Unload Out-of-Process C++ Library
If you run the Enable out-of-process execution mode section in the
workflow script created by the
clibPublishInterfaceWorkflow function, then you can unload the C++ library by
running the Unload out-of-process library section.
unload on the MATLAB interface. For example, suppose that you built an interface
schoolInterface.dll to the
school C++ library and
the interface is loaded and set to out-of-process execution. To verify, type:
configObj = clibConfiguration("school")
configObj = CLibraryConfiguration for school with properties: InterfaceLibraryPath: "C:\work" Libraries: "" Loaded: 1 ExecutionMode: outofprocess ProcessID: 12345
To unload the library, type:
Information About the Host Process
CLibraryConfiguration object created from calling the
clibConfiguration function to get information about the host process.
These properties provide information about the settings and status of a MATLAB interface to a C++ library.
InterfaceLibraryPathcontains the path to the interface library.
Librariescontains the names of libraries used to build the interface.
Loadedcontains the process status, specified as 1 if the library is loaded, otherwise 0.
ExecutionModeindicates whether to load the C++ interface in the same process as MATLAB, specified as
ProcessNamecontains the name of the host process, which for
ProcessIDcontains the process identifier.