MATLAB COMPILER 4 Manuel d'utilisateur Page 10

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 21
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 9
4.3 Compiling M-Files to Stand-Alone Applications
It is assumed that there is an M-file that serves as main file, that maybe calls some helper
functions. Moreover the main files may use functions of the MATLAB C/C++ Graphics
Library. To generate an executable s tand-alone application from these files 3 steps are
necessary. Therefore it is convenient to use a Makefile rather than calling the compiler
from the command line. For reasons of readability the compiling and linking step is given
as a scratch of a Makefile [1], respectively (see: Listing 1):
(i) Convert M-Files to C source code using the mcc (no compiling):
mcc -t -W main -h -c libmmfile.mlib main.m
mcc -t -B sgl -h -c libmmfile.mlib main.m
(ii) Compile C source files:
gcc -c -I$(INCL) $(CFLAGS) $(SRCS)
(iii) Link compiled object files against MATLAB libraries to an executable:
gcc $(LDFLAGS) -o test $(OBJS) $(LDLIBS)
...
SRCS = $ ( wildcard *. c )
OBJS = $ ( wildcard *. o )
INCL = MATLAB_DIR / extern / i n lcude
LIBBIN = MATLAB_DIR / bin / glnx86
LIBEXTERN = MATLA B _ DIR / extern / lib / glnx86
LIBSYS = MATL A B_LIB _ DIR / sys / os / glnx86
LIBS = -lmwsgl -lmwhg - lm w sglm - lmmfile - lmatlb -lmx -l m wservice s \
- lmex - lut - lm - lm
LDLIBS = -Wl , -- rpath - link ,$( LIBBIN ) ,- - rpath - link ,$ ( L IBEXTERN ) ,...
... - - rpath - link , $( LIBSYS ) -L$ ( LIBBIN ) -L$ ( LIBEXTERN ) -L$ ( LIBSYS ) $ ( LIBS )
LDF LAGS = -pthread -g -O
CFLAGS = - DUNIX -ansi - D _GNU_S OURCE - pthread -g -O -DNDEBUG
...
Listing 1: Makefile
Annotation
(i) Using the second line the wrapper main-file would enable to link to the MATLAB
C/C++ Graphics Library at linking stage.
10
Vue de la page 9
1 2 ... 5 6 7 8 9 10 11 12 13 14 15 ... 20 21

Commentaires sur ces manuels

Pas de commentaire