To compile MATLAB® code into a shared library:
Open the Library Compiler app.
On the toolstrip select the Apps tab.
Click the arrow at the far right of the tab to open the apps gallery.
Click Library Compiler to open the MATLAB Compiler project window.
To open an existing project, select it from the MATLAB Current Folder panel.
You can also launch the Library Compiler app using the
In the Application Type section of the toolstrip, select either C Shared Library or C++ Shared Library.
If the Application Type section of the toolstrip is collapsed, you can expand it by clicking the down arrow.
Specify the MATLAB files you want deployed in the shared library.
In the Exported Functions section of the toolstrip, click the plus button.
If the Exported Functions section of the toolstrip is collapsed, you can expand it by clicking the down arrow.
In the file explorer that opens, locate and select one or more MATLAB files.
Click Open to select the file and close the file explorer.
The names of the selected files are added to the list and a minus button appears below the plus button. The name of the first file listed is used as the default application name.
In the Packaging Options section of the toolstrip, specify how the installer will deliver the MATLAB Runtime with the shared library.
If the Packaging Options section of the toolstrip is collapsed, you can expand it by clicking the down arrow.
You can select one or both of the following options:
Runtime downloaded from web — Generates an installer that downloads the MATLAB Runtime installer from the web.
Runtime included in package — Generates an installer that includes the MATLAB Runtime installer.
Selecting both options creates two installers.
Regardless of the options selected the generated installer scans the target system to determine if there is an existing installation of the appropriate MATLAB Runtime. If there is not, the installer installs the MATLAB Runtime.
Specify the name of any generated installers.
In the Application Information and Additional Installer Options sections of the app, customize the look and feel of the generated installer.
You can change the information used to identify the application data used by the installer:
Name and contact information of the library’s author
Brief summary of the library’s purpose
Detailed description of the library
You can also change the default location into which the library is installed and provide some notes to the installer.
All of the provided information is displayed as the installer runs.
For more information see Customize the Installer.
In the Files required for your application to run section of the app, verify that all of the files required by the deployed MATLAB functions are listed.
These files are compiled into the generated binaries along with the exported files.
In general the built-in dependency checker will automatically populate this section with the appropriate files. However, if needed you can manually add any files it missed.
For more information see Manage Required Files in Compiler Project.
In the Files installed for your end user section of the app, verify that any additional non-MATLAB files you want installed with the application are listed.
These files are placed in the
of the installed application.
This section automatically lists:
Generated shared library
Dynamically linked library
You can manually add files to the list. Additional files can include documentation, sample data files, and examples to accompany the application.
For more information see Specify Files to Install with Application.
Click the Settings button to customize the flags passed to the compiler and the folders to which the generated files are written.
Click the Package button to compile the MATLAB code and generate any installers.