Main Content

CLibraryConfiguration

C++ library interface environment information

Since R2023a

Description

CLibraryConfiguration objects contain information about the settings and status of a MATLAB® interface to a C++ library. The environment information is persistent across different MATLAB sessions.

Creation

To create a CLibraryConfiguration object or change the settings, call clibConfiguration. The library is loaded when you call a command in the clib namespace. You cannot change the execution mode after MATLAB loads the library. To change how the library is loaded, restart MATLAB, and then call clibConfiguration.

Properties

expand all

This property is read-only.

Path to the interface library, returned as a string.

This property is read-only.

Libraries used to build the interface, returned as a string or an array of string.

Process status, specified as 1 if the library is loaded, otherwise 0.

Execution mode indicating whether to load the C++ interface in the same process as MATLAB or in an external process, specified as inprocess or outofprocess. To set the ExecutionMode property, call clibConfiguration with the ExecutionMode argument.

This property is read-only.

MATLAB process ID, returned as uint64. If the library is not loaded, then ProcessID is not displayed.

This property is read-only.

Process name in the registry, returned as a string. The default name for out-of-process is MATLABCLibHost. If the library is not loaded, then ProcessName is not displayed.

Object Functions

unloadUnload process associated with C++ library

Examples

collapse all

Suppose that you built an interface libnameInterface.dll in C:\work which is on the MATLAB path for a library libname.lib.

Call function myfunc in the library:

clib.libname.myfunc

Display the configuration:

configObj = clibConfiguration("libname")
configObj =
      CLibraryConfiguration for libname with properties:
        InterfaceLibraryPath: "C:\work"
                   Libraries: "libname.lib"
                      Loaded: 1
               ExecutionMode: inprocess
                   ProcessID: 12345

Version History

Introduced in R2023a