MATLAB®
Coder™ can use built-in C data types or predefined types from
rtwtypes.h
in generated code. By default, when the generated code
declares variables, it uses built-in C types.
You can explicitly specify the data types used in generated code in the project settings dialog box or at the command line.
To open the Generate dialog box, on the
Generate Code page, click the
Generate arrow .
Set Build type to Source Code
,
Static Library
, Dynamic
Library
, or Executable
(depending on
your requirements).
Click More Settings.
To use built-in C types, on the Code Appearance tab, set
Data Type Replacement to Use built-in C data
types in the generated code
. To use predefined types from
rtwtypes.h
, set Data Type Replacement
to Use MathWorks typedefs in the generated code
.
Create a configuration object for code generation. Use coder.config
with arguments
'lib'
,'dll'
, or 'exe'
(depending on your requirements). For example:
cfg = coder.config('lib');
To use built-in C types, set the DataTypeReplacement
property to 'CBuiltIn'
.
cfg.DataTypeReplacement = 'CBuiltIn';
To use predefined types from rtwtypes.h
, set the
DataTypeReplacement
property to
'CoderTypedefs'
.