Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Compile MATLAB Functions

Compile MATLAB® functions for use in applications coded in other languages

Before you can integrate MATLAB functions into external applications, you need to compile them for the target language. MATLAB Compiler SDK™ includes two apps and a command-line compiler for this purpose. The apps guide you in specifying functions to compile and in creating an installer. Target-language developers install the compiled code on the development system, along with the MATLAB Runtime, which is necessary to run the code. At the command-line, you can compile the MATLAB functions into a binary package the target language developer uses in developing their applications.

Apps

Library CompilerPackage MATLAB programs for deployment as shared libraries and components
Production Server CompilerPackage MATLAB programs for deployment to MATLAB Production Server

Functions

libraryCompilerBuild and package functions for use in external applications
productionServerCompilerTest, build and package functions for use with MATLAB Production Server
mccCompile MATLAB functions for deployment
mbuildCompile and link source files against MATLAB generated shared libraries
deploytoolCompile and package functions for external deployment
componentinfoQuery system registry about COM component created with MATLAB Compiler SDK
isdeployedDetermine whether code is running in deployed or MATLAB mode
ismccTest if code is running during compilation process (using mcc)
ctfrootLocation of files related to deployed application
figToImStreamStream figure as byte array encoded in specified format
webfigureExport a figure to a deployed application
getmcruserdataRetrieve MATLAB array value associated with a given key
setmcruserdataAssociate MATLAB data value with a key
%#functionPragma to help MATLAB Compiler locate functions called through feval, eval, Handle Graphics callback, or objects loaded from MAT-files

Examples and How To

C/C++

Install an ANSI C or C++ Compiler

Installing a supported C/C++ compiler

Compile C/C++ Shared Libraries with Library Compiler App

The Library Compiler App is a graphical tool for compiling and packaging C/C++ shared libraries.

Compile C/C++ Shared Libraries from Command Line

Using the command line compiler to create C/C++ shared libraries.

Distribute C/C++ Shared Libraries to Application Developers

Distribute the following to the application developer integrating the shared library:

.NET

Create a .NET Assembly

This example shows how to transform a MATLAB function into a .NET assembly.

Compile .NET Assemblies from Command Line

Using the mcc command line to build your assembly

Distribute .NET Assemblies to Application Developers

Distribute the following to the application developer integrating the .NET assembly:

Java

Configure Your Java Environment

Configuring the Java® environment for compilation of MATLAB code and development of Java applications

Compile Java Packages with Library Compiler App

The Library Compiler App is a graphical tool for compiling and packaging Java packages.

Compile Java Packages from Command Line

Using the command line compiler to create Java packages.

Map Functions to Java Class Methods

Mapping MATLAB functions to Java classes

Distribute Java Packages to Application Developers

Distribute the following to the application developer integrating the package:

Python

Compile Python Packages with Library Compiler App

MATLAB Compiler SDK cannot compile MATLAB code that uses the MATLAB Python® interface.

Compile Python Packages from Command Line

MATLAB Compiler SDK cannot compile MATLAB code that uses the MATLAB Python interface.

Distribute Python Packages to Application Developers

Distribute the following to the application developer integrating the package:

MATLAB Production Server

Compile Deployable Archives with Production Server Compiler App

The Production Server Compiler App is a graphical tool for compiling and packaging deployable archives.

Compile Deployable Archives from Command Line

Using the command line compiler to create deployable archives.

Build Excel Add-In and Deployable Archive

The Excel integration with MATLAB Production Server builds two artifacts. One is for the server and one is for the client.

COM

Compile COM Components with Library Compiler App

How to create a COM component

Compile COM Components from Command Line

How you can use the mcc command instead of the GUI to build COM objects

Distribute COM Components to Application Developers

Distribute the following to the application developer integrating the component:The Library Compiler app generates an installer that packages all of the binary artifacts required for distributing a COM component.

Customization

Customize the Installer

How to customize the look and feel of the installer generated by the compiler app

Manage Required Files in Compiler Project

How to ensure that the compiler includes all of the required MATLAB files when generating the application

Specify Files to Install with Application

How to include extra files to be installed along with the application

Manage Support Packages

The compiler attempts to package any support packages required by an application.

Simplify Compilation Using Macros

Information on macros and how they can simplify your work

Invoke MATLAB Build Options

Using path name, bundles, and wrapper files to build your MATLAB code

Concepts

Differences Between Compiler Apps and Command Line

You perform the same functions using either the compiler apps or the mcc command-line interface.

How Does MATLAB Deploy Functions?

To deploy MATLAB functions, the compiler performs these tasks:

Write Deployable MATLAB Code

Writing MATLAB code that is sure to compile

State-Dependent Functions

MATLAB code that you want to deploy often carries state—a specific data value in a program or program variable.

MATLAB Runtime Component Cache and Deployable Archive Embedding

How to override the default deployable archive embedding behavior and how to use MATLAB Runtime Component Cache

Using the MATLAB Runtime User Data Interface

Information on how to access MATLAB Runtime data

Display the MATLAB Runtime Initialization Messages

Procedure to create console messages for end users

MATLAB Functions That Cannot Be Compiled

Functions not able to be compiled with MATLAB Compiler™ or MATLAB Compiler SDK

MATLAB Compiler SDK Limitations

Restrictions regarding what can be compiled

Was this topic helpful?