Clear Filters
Clear Filters

What libraries should I include when distributing my stand-alone application?

14 views (last 30 days)
I would like to deploy a stand-alone application that was generated by MATLAB Compiler. I would like to know what libraries to include when distributing my standalone application.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Sep 2015
As of MATLAB Compiler 4.0 (R14), all MATLAB run-time libraries necessary to run your application are included in MATLAB Compiler Runtime. In order to install MATLAB Compiler Runtime on a target machine, deploy and run the file mcrInstaller.exe, which is located in the following location on PC:
On UNIX/LINUX, use BUILDMCR to create a deployable MCR ZIP-file.
In addition to deploying MATLAB Compiler Runtime, you should also include the following in your distribution:
1. The application file generated by MATLAB Compiler (your executable or shared library).
2. The CTF-file generated by MATLAB Compiler.
Note: In R2008a, the CTF-file is no longer a seperate file. By default it is embedded inside the standalone application.
After MATLAB Compiler Runtime has been installed on the target machine, the application file and CTF-file must reside in the same directory in order for the stand-alone application to run.
For previous versions of MATLAB Compiler or the Math and Graphics Libraries, read the following:
The MATLAB Math and Graphics Libraries for R12 and R13 have prepackaged all the MATLAB run-time libraries required by stand-alone applications into a single, self-extracting archive file, called the MATLAB Math and Graphics Run-Time Library Installer. Instead of including all the run-time libraries individually in your stand-alone application distribution package, simply distribute the mglinstaller.exe with your stand alone application.
On UNIX, the MGLINSTALLER is located in the $MATLAB/extern/lib/$ARCH/mglinstaller directory.
On PC, the MGLINSTALLER.EXE is located in the $MATLAB\extern\lib\win32\mglinstaller.exe
You should include the following in your distribution:
  • The contents, if any, of a directory named 'bin', created by MBUILD in the same directory as your application executable
  • Any custom MEX files your application uses
  • All the MATLAB Math run-time libraries
You may run into this problem:
Your application may compile successfully but fail when you try to start it. If you run the application from a DOS command window, you or one of your users may see an error message such as:
  ERROR: The ordinal #### could not be located in the dynamic-link library dforrt.dll.
To fix this problem, locate the files named dforrt.dll or dformd.dll in your Windows system directory and replace them with the versions of these files in the $MATLAB\bin\win32 directory, where $MATLAB represents the name of your root MATLAB installation directory.
This same solution works for users of your application who encounter the same problem. They can, however, replace the versions of these files in the Windows system directory with the versions they find in <MGLRUNTIMELIBRARY>\bin\win32 directory, where <MGLRUNTIMELIBRARY> is the name of the directory in which they installed the MATLAB Math and Graphics Run-Time Libraries.
For MATLAB 5.3.x or MATLAB 5.2:
The MGLINSTALLER utility was not available with these versions. In order to distribute a stand-alone application with these earlier versions, you must include the application's executable as well as the shared libraries against which the application was linked. This package of files includes:
sgl.ext (if your application uses the Graphics Library)
where .ext is .dll on Windows; .a on IBM RS/6000 and Sun4; .so on Solaris, Alpha, Linux, and SGI; and .sl on HP 700.
The DLLs must be on the system path. You must either install them in a directory that is already on the path or modify the PATH variable to include the new directory.
This information can also be found in the MATLAB C Math Library 2.1 (R12) User's Guide, under the sections titled "Distributing Stand-Alone <platform> Applications," where <platform> indicates either Microsoft Windows or UNIX.

More Answers (0)


Find more on MATLAB Compiler in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!