Documentation

C/C++ Shared Library Integration

Integrate compiled MATLAB®functions into C or C++ applications

集成编译C或MATLAB函数C++ application requires you to use a combination of APIs.MATLAB Compiler SDK™uses APIs to initialize theMATLAB Runtime, load the compiled MATLAB functions into theMATLAB Runtime, and manage data that is passed between the C or C++ code and theMATLAB Runtime. The compiler generates some of the APIs based on the signatures of the compiled functions.MATLAB Runtimeprovides other APIs that are consistent for all applications.

To integrate MATLAB functions with your application code seeCall a Shared Library.

Functions

mbuild Compile and link source files against MATLAB generated shared libraries

C/C++ API

mclmcrInitialize Initializes the MATLAB Runtime proxy library
mclInitializeApplication Set up application state shared by all MATLAB Runtime instances created in current process
mclTerminateApplication Close MATLAB Runtime-internal application state
Initialize[WithHandlers] Initialize MATLAB Runtime instance associated with library
Terminate Free all resources allocated by MATLAB Runtime instance associated with library
mwArray Class used to pass input/output arguments to C++ functions generated by MATLAB Compiler SDK
mwException Exception type used by the mwArray API and the C++ interface functions
mwString String class used by the mwArray API to pass string data as output from certain methods
mclRunMain Mechanism for creating identical wrapper code across all platforms
mclIsMCRInitialized Determine if MATLAB Runtime has been properly initialized
mclWaitForFiguresToDie Enable deployed applications to process graphics events, enabling figure windows to remain displayed
mclGetLastErrorMessage Last error message from unsuccessful function call
mclGetLogFileName Retrieve name of log file used by MATLAB Runtime
mclIsJVMEnabled Determine if MATLAB Runtime was launched with instance of Java Virtual Machine (JVM)
mclIsNoDisplaySet Determine if -nodisplay mode is enabled

Examples and How To

Integrate a C/C++ Shared Library into an Application

This example shows how to call a C++ shared library built withMATLAB Compiler SDKfrom a C++ application.

Call a Shared Library

To use aMATLAB Compiler SDKgenerated shared library in your application:

Integrate C Shared Libraries

Creating and distributing C shared libraries

Integrate C++ Shared Libraries

Creating and distributing C++ shared libraries

Call MATLAB Compiler SDK API Functions from C/C++

UsingMATLAB Compiler SDKgenerated interface functions

Use Multiple Shared Libraries in Single Application

Use multple generated shared libraries in a single C/C++ application

Configure the mbuild Options File

Configuring a supported C/C++ compiler to work withMATLAB Compiler SDK

Call COM Objects in Visual C++ Programs

How to integrate a COM object into a Visual C++®program

Concepts

MATLAB Runtime Path Settings for Development and Testing

Path settings for machines where you want to develop and test applications that contain compiled MATLAB code

Memory Management and Cleanup

Recommendations on memory management

MATLAB Runtime Startup Options

SetMATLAB Runtimeoptions, such as-nojvm,-nodisplay, or-logfile

Understand the mclmcrrt Proxy Layer

All application and software components generated byMATLAB Compiler™andMATLAB Compiler SDKneed to link against only one MATLAB library,mclmcrrt.

MATLAB Runtime Component Cache and Deployable Archive Embedding

How to override the default archive embedding behavior and how to useMATLAB Runtimecomponent cache

Was this topic helpful?