Skip to Main Content Skip to Search
Product Documentation

Distributing Your Standalone Application or Shared Library

The C or C++ developer performs these tasks.

C/C++ Developer

RoleKnowledge BaseResponsibilities

C/C++ developer
  • Little to no MATLAB experience

  • Moderate IT experience

  • C/C++ expert

  • Minimal access to IT systems

  • Integrates deployed component with the rest of the C or C++ application

  • Integrates deployed MATLAB Figures with the rest of the C or C++ application

Key Tasks for the C or C++ Developer

TaskReference
Ensure that you have the needed files from the MATLAB programmer before proceeding.Gathering Files Necessary for Deployment
Distribute the files.Distribute to End Users
Install the MCR on target computers by running the MCR Installer. Update system paths on UNIX systems.Distribute MATLAB Code Using the MATLAB Compiler Runtime (MCR)
Ensure that the final standalone application or library executes reliably in the end-user environment.Build and Test

Gathering Files Necessary for Deployment

Before beginning, verify that you have access to the following files, packaged by the MATLAB programmer in Package Copying (Optional). End users who do not have a copy of MATLAB installed need the following:

See Packaging (Optional) for more information about these files.

Distribute to End Users

If the MATLAB programmer packages the standalone or library (see Packaging (Optional)), paste the package in a folder on the target machine, and run it. If you are using an archive file, extract the contents to the target machine.

Distribute MATLAB Code Using the MATLAB Compiler Runtime (MCR)

On target computers without MATLAB, install the MCR, if it is not already present on the deployment machine.

MATLAB Compiler Runtime (MCR) and the MCR Installer

The MATLAB Compiler Runtime (MCR) is an execution engine made up of the same shared libraries MATLAB uses to enable the execution of MATLAB files on systems without an installed version of MATLAB.

The MATLAB Compiler Runtime (MCR) is now available for downloading from the Web to simplify the distribution of your applications or components created with the MATLAB® Compiler. Direct your end users to the MATLAB Compiler product page to download the MCR, as opposed to redistributing or packaging it with your applications or components.

In order to deploy a component, you can either package the MCR along with it or simply direct your end users to download it from the Web.

Before you utilize the MCR on a system without MATLAB, run the MCR Installer. Locate the installer my entering the mcrinstaller command from MATLAB.

The installer does the following:

  1. Installs the MCR (if not already installed on the target machine)

  2. Installs the component assembly in the folder from which the installer is run

  3. Copies the MWArray assembly to the Global Assembly Cache (GAC), as part of installing the MCR

MCR Prerequisites

  1. Since installing the MCR requires write access to the system registry, ensure you have administrator privileges to run the MCR Installer.

  2. The version of the MCR that runs your application on the target computer must be compatible with the version of MATLAB Compiler that built the component.

  3. Avoid installing the MCR in MATLAB installation directories.

Add the MCR Installer To Your Deployment Package

Include the MCR in your deployment by using the Deployment Tool.

On the Package tab of the deploytool interface, click Add MCR.

Testing with the MCR

When you test with the MCR, keep in mind that the MCR is an instance of MATLAB. Given this, it is not possible to load the MCR into MATLAB.

For example, if you build a generic COM component with the Deployment Tool from MATLAB Builder™ NE, you generate a DLL.

If you then try to test the component with an application such as actxserver, which loads its process into MATLAB, you are effectively loading the MCR into MATLAB, producing an error such as this:

mwsamp.mymagic(3,[],[]) 
??? Invoke Error, Dispatch Exception: 
Source: tmw1.Class1.1_0 
Description: MCR instance is not available 

Therefore, understand the behaviors of third-party processes before attempting to test them with the MCR.

If you are uncertain about the behavior of these processes, contact your developer or systems administrator.

MCR Installation and Setting System Paths

To install the MCR, perform the following tasks on the target machines:

  1. If you added the MCR during packaging, open the package to locate the installer. Otherwise, run the command mcrinstaller to display the locations where you can download the installer.

  2. If you are running on a platform other than Windows, set the system paths on the target machine. Setting the paths enables your application to find the MCR.

    Windows paths are set automatically. On Linux and Mac, you can use the run script to set paths. See Using MATLAB Compiler on Mac or Linux for detailed information on performing all deployment tasks specifically with UNIX variants such as Linux and Mac.

Build and Test

Build and test the standalone application or shared library as you would any application in your environment. After you create and distribute the initial application, you continue to enhance it.

  


Free MATLAB Compiler Interactive Kit

Learn how to build standalone executables and C/C++ shared libraries from MATLAB code.


Get free kit

Trials Available

Try the latest version of MATLAB Compiler.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS