Customize C/C++ File Names Generated from MATLAB Code
If you have Embedded Coder®, you can customize the file names of the C/C++ code generated from MATLAB® code. By changing the file names, you can avoid name clashes when integrating
different C/C++ code projects together. Customize the file names by setting the file name
CustomFileNameStr to a macro. The macro can include:
Valid file name characters.
The tokens listed in the following table.
Code generator inserts name mangling text to avoid naming collisions.
Code generator inserts the non-customized file name.
Code generator inserts the root project name into the file name, replacing unsupported characters with the underscore (_) character.
By default, the macro is set to
Customize File Names by Using the MATLAB Coder App
On the Generate Code page, to open the Generate dialog box, click the Generate arrow .
Set Build type to one of the following:
Click More Settings.
Enter the macro on the Code Appearance tab, next to Generated source and header files:
For example, suppose you set the macro to the value
ec_$N$M. For an
entry-point function called
foo, when name mangling is not required, the
generated file name for
ec_foo. If name
mangling is required, the generated file name includes the name mangling text.
Customize Generated File Names by Using the Command-Line Interface
Create a code generation configuration object for a library or executable program. For example:
cfg = coder.config('lib','ecoder',true);
Specify the file name macro as a character vector in the
CustomFileNameStrobject property. For example:
cfg.CustomFileNameStr = 'ec_$N$M';
For an entry-point function called
foo, when name mangling is not required, the generated file name for
ec_foo. If name mangling is required, the generated file name includes the name mangling text.