Compiling MATLAB M-Files for Usage Within anC-ApplicationPeter M. Roth, Martin Winter{pmroth, winter}@icg.tu-graz.ac.atDecember 17, 20041 Introduction
4.3 Compiling M-Files to Stand-Alone ApplicationsIt is assumed that there is an M-file that serves as main file, that maybe calls some helperfunctions.
(ii) The CLFAGS used for compiling can be obtained by calling the mmc in the verboseand debug mode. View the output ofmcc -t -W main -h -c -v -G libmm
Annotation(i) Libraries under Linux are restricted to the prefix lib in the library name. Using thesecond line the library will be linked to the MATLAB
5 Include compiled MATLAB functions to C-code5.1 Preliminary NotesC Code onlyGenerally it is possible to generate C code as well as C++ code from exis
1 #in c lu d e " matlab .h "2 #in c lu d e " l ibsimple .h "34 i n t main ( i n t argc , char * argv [])5 {6 /* define variable s
fun cti on [C , D ] = simple (A , B , T e stStr )f p r i n t f ([ TestStr , ’\ n\ n ’]);C = A + B ;D = A * B ;return ;Listing 3: simple.mThis is a Tes
5.2.2 Compile the Example Source CodeReferring again to Listing 1 and following the steps in Section 4.4 an instruction forcompiling and linking the e
5.4 Simple C++ Template for a MATLAB LibraryIn the following we show a template for a wrapper-class for simply including compiledMATLAB source code in
#in c lu d e " wrapper . h"#in c lu d e " libcppdemo . h"// co n structorTemp late _ Comp onen t :: T empl ate_ Comp o nen t (){//
Appendix AA.1 Needed M-files for CompilingWe needed to copy all files given in the list below to the local working directory whengenerating C-source cod
2 MATLAB Compiler mcc2.1 Preliminary NotesThe MATLAB Compiler mcc can translate M-files into C or C++ source code. Theresulting files can be used in any
A.2 Needed MEX-files for compilingAdditionally to the functions that exist as M-file you would need to include those functionsthat are compiled to a MEX
References[1] Stallman R.M., McGrath R., Smith P., GNU Make, Free Software Foundation, 2002[2] Stallman R.M., Using and Porting the GNU Compiler Colle
2.2 mcc Compiler Option FlagsThe following table gives a short overview of the most important compiler option flagsneeded for generation of C/C++ code.
2.3 Limitations and RestrictionsThere are some limitations and restrictions using the MATLAB Compiler. Therefore mcc(Version 3.0) cannot compile:• M-fi
1. Create a text file containing the text -I dir name for each directory you want onthe default path, and name this file mccpath.2. Place this file in yo
3 Windows XP3.1 Compiling M-files to Stand-Alone Applications• Extract MatLab Compiling Files Win32.zip to the local compiling directory. ThisZIP-file c
• some other c-files, h-files a.s.oNotes:• You can use the .c and .h files for compiling a library with another compiler.• For executing an application i
This w ill create an import library for an existing library libname.dll that now can b elinked against an application using gcc. An example bat-file cr
4 Linux4.1 Preliminary NotesAll steps described in this section may be done inside the MATLAB environment mucheasier. On the one hand side all the pat
Comments to this Manuals