HowToCompile - Guideline for Compiling MATLAB M-Files for...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Guideline for Compiling MATLAB M-Files for Usage Within an C-Application Peter M. Roth, Martin Winter, (ICG) May 13, 2004 1 Introduction 1.1 General Notes The following guideline describes the steps to do to a proper compilation of MATLAB source code (M-files) for integration into a C/C++ framework, i.e the FSP-Framework zwork for Computer Vision applications. Due to some bugs and unresolved known problems in the MATLAB Compiler (Ver- sion 3.0) of MATLAB 6.5 Rel.13, it is essential to follow some restrictions and a handful of workarounds. The presented solutions are partially officially solutions published by MathWorks Inc. but most of them result from our observations during the crucial at- tempts to compile and integrate our MATLAB code into stable applications under Linux. 1.2 Environment for that this guide is valid: MATLAB 6.5 Rel.13 (Linux, Windows) Windows XP : Visual Studio 6.0 , gcc 2.3.2 Linux: gcc 2.95 , gcc 3.2.2 , gcc 3.3.1 1.3 Structure of the Document Section 2 gives a general overview of the usage of the MATLAB Compiler mcc that is valid for Windows as well as for Linux operating system. Section 3 gives a detailed guideline for compiling M-files under Windows XP using Visual Studio 6.0, as Section 4 gives a detailed guideline for compiling M-files under a Linux environment. In the end Section 5 gives a short introduction how to include existing compiled M-files into a C framework. 1 2 MATLAB Compiler mcc 2.1 Preliminary Notes The MATLAB Compiler mcc can translate M-files into C or C++ source code. The resulting files can be used in any of the supported executable types (MEX, stand-alone executable, library) by generating an appropriate wrapper file. A wrapper file contains the required interface between the mcc-generated code and a supported executable type. For compilation and linking any ANSI C or C++ compiler may be used. Therefore the mcc itself is not a ANSI C or C++ compiler! At the linking stage the resulting object files are linked against the MATLAB C/C++ Math and Graphics Libraries (see: Figure 1 ). To create a stand-alone C or C++ application, the the following steps are processed by the MATLAB Compiler mcc : 1. Translation of the given M-files into C or C++ source code. 2. Generation of additional C or C++ source code modules (wrapper files). 3. Invocation of a C or C++ compiler and linker. Figure 1: Creating a C stand-alone application [ 4 ] 2 2.2 mcc Compiler Option Flags The following table gives a short overview of the most important compiler option flags needed for generation of C/C++ code. For a complete list of all option flags refer to [ 4 ]. Option Description-B filename Passes a bundle of compiler settings stored in filename to the mcc. A set of predefined bundles are located in matlab dir /toolbox/compiler/bundles ....
View Full Document

This note was uploaded on 10/16/2011 for the course MECHANICAL 000 taught by Professor R during the Fall '11 term at IUPUI.

Page1 / 16

HowToCompile - Guideline for Compiling MATLAB M-Files for...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online