MATLAB COMPILER 4 Manual de usuario Pagina 11

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 21
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 10
(ii) The CLFAGS used for compiling can be obtained by calling the mmc in the verbose
and debug mode. View the output of
mcc -t -W main -h -c -v -G libmmfile.mlib main.m
to determine the CLFAGS for compiling the code correctly. They should be the
same for all M-files.
(iii) To determine the LDFLAGS and the necessary libraries for linking the code correctly,
look again at the output of the mmc in the verbose and debug mode.
The linker option (initialized by -Wl,) −−rpath-link,lib dir name
3
must be set for
all directories that include libraries that the application is linked with. Otherwise
some linkers would not find these shared libraries [2].
The usage of wildcard expressions is not a very pretty solution, but at compile time you
would not know which C-files the MATLAB Compiler would generate. Another bothering
consequence of using these wildcard e xpression in Makefiles is the fact that you cannot run
the convert, compile and link target within the same make command. Since the wildcard
expressions are evaluated when the Makefile is called, there would not exist any *.c or *.o
files that can be compiled or linked. As a simple workaround to fix this, you can write a
Makefile containing the targets convert, compile and link, that call a Sub-Makefile with
the same target, respectively.
4.4 Compiling M-Files to Shared Libraries
For creating a shared library the same 3 s teps as in Section 4.3 are necessary. Only some
compiler option flags are different. The Makefile-notation refers again to Listing 1:
(i) Convert M-Files to C source code using the mcc (no compiling):
mcc -v -t -W lib:libname of lib -L C -T link:lib -h -c libmmfile.mlib
fun 2.m fun 1.m ... .
mcc -v -t -W lib:libname of lib -L C -T link:lib -h -c libmmfile.mlib
libmwsglm.mlib fun 2.m fun 1.m ...
(ii) Compile C source files:
gcc -c -fPIC -I$(INCL) $(CFLAGS) $(SRCS)
(iii) Link compiled object files against MATLAB libraries to a library:
gcc $(LDFLAGS) -shared -o libtest.so $(OBJS) $(LD LIB S)
3
The ... are inserted for readability reasons only. Using the -Wl option you must not use blanks,
otherwise the option would not be recognized by the linker. Therefore you cannot insert a manual line
break using a slash, since this will unfortunately insert a blank at the position of the line break.
11
Vista de pagina 10
1 2 ... 6 7 8 9 10 11 12 13 14 15 16 ... 20 21

Comentarios a estos manuales

Sin comentarios