MATLAB XPC TARGET 4 - API GUIDE Guía de usuario Pagina 203

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 372
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 202
Step-by-Step Example of Fortran and xPC Target
11-9
Creating a C-MEX Wrapper S-Function
This section assumes that you have compiled your Fortran code. See
“Compiling Fortran Files” on page 11-7.
Write the wrapper S-function for
sfun_atmos_sub.f. A wrapper S-function is
code that incorporates existing Fortran code into a Simulink S-Function block.
For details on writing such wrapper functions, refer to the writing S-Functions
Simulink documentation.
The wrapper S-function calls the Fortran subroutine
Atmos with the
appropriate calling convention:
atmos_. (Refer to “Creating Fortran
S-Functions” in the writing S-Functions documentation for further information
about calling conventions.) The wrapper S-function file for this example is
called
sfun_atmos.c.
1 Change directory to <MATLAB root>\simulink\src.
2 Copy the file sfun_atmos.c into your Fortran working directory, for
example,
xpc_fortran_test.
Your next task is to compile and link the wrapper S-function. See “Compiling
and Linking the Wrapper S-Function” on page 11-9.
Compiling and Linking the Wrapper S-Function
Create (compile and link) a DLL (C-MEX DLL) from the sfun_atmos.c file. Use
the
mex command with a C/C++ compiler such as Microsoft Visual C/C++
Version 6.0.
Before you start, copy the following run-time library files from the Fortran
compiler installer directory, such as
C:\Program Files\Microsoft Visual
Studio\DF98\lib
, into the working directory, xpc_fortran_test. Copying
these files simplifies the build process.
dfor.lib
dformd.lib
dfconsol.lib
dfport.lib
This section assumes that you have created a C_MEX wrapper S-function. See
“Creating a C-MEX Wrapper S-Function” on page 11-9.
Vista de pagina 202
1 2 ... 198 199 200 201 202 203 204 205 206 207 208 ... 371 372

Comentarios a estos manuales

Sin comentarios