File Infrastructure and Paths Setup
Compile Path Search Order
fiaccel
resolves function calls by searching first on the code
generation path and then on the MATLAB® path. By default, fiaccel
tries to compile and generate
code for functions it finds on the path unless you explicitly declare the function to be
extrinsic. An extrinsic function is a function on the MATLAB path that is dispatched to MATLAB software for execution. fiaccel
does not compile
extrinsic functions, but rather dispatches them to MATLAB for execution.
Naming Conventions
MATLAB enforces naming conventions for functions and generated files.
Reserved Prefixes
MATLAB reserves the prefix eml
for global C functions and
variables in generated code. For example, run-time library function names all begin with
the prefix emlrt
, such as emlrtCallMATLAB
. To avoid
naming conflicts, do not name C functions or primary MATLAB functions with the prefix eml
.
Reserved Keywords
MATLAB Coder™ software reserves certain words for its own use as keywords of the generated code language. MATLAB Coder keywords are reserved for use internal to MATLAB Coder software and should not be used in MATLAB code as identifiers or function names. C reserved keywords should also not be used in MATLAB code as identifiers or function names. If your MATLAB code contains reserved keywords that the code generator cannot rename, the code generation build does not complete and an error message is displayed. To address this error, modify your code to use identifiers or names that are not reserved.
If you are generating C++ code using the MATLAB Coder software, in addition, your MATLAB code must not contain the C++ Reserved Keywords.
C Reserved Keywords
assert | extern | setjmp | string |
auto | fenv | short | struct |
break | float | signal | switch |
case | for | signed | tgmath |
char | goto | sizeof | threads |
const | if | static | time |
complex | int | stdalign | typedef |
continue | inttypes | stdarg | uchar |
ctype | iso646 | stdatomic | union |
default | limits | stdbool | unsigned |
do | locale | stddef | void |
double | long | stdint | volatile |
else | math | stdio | wchar |
enum | register | stdlib | wctype |
errno | return | stdnoreturn | while |
C++ Reserved Keywords
algorithm | cstddef | iostream | sstream |
any | cstdint | istream | stack |
array | cstdio | iterator | static_cast |
atomic | cstdlib | limits | stdexcept |
bitset | cstring | list | streambuf |
cassert | ctgmath | locale | string_view |
catch | ctime | map | strstream |
ccomplex | cuchar | memory | system_error |
cctype | cwchar | memory_resource | template |
cerrno | cwctype | mutable | this |
cfenv | delete | mutex | thread |
cfloat | deque | namespace | throw |
chrono | dynamic_cast | new | try |
cinttypes | exception | numeric | tuple |
ciso646 | execution | operator | typeid |
class | explicit | optional | type_traits |
climits | export | ostream | typeindex |
clocale | filesystem | private | typeinfo |
cmath | foreward_list | protected | typename |
codecvt | friend | public | unordered_map |
complex | fstream | queue | unordered_set |
condition_variable | functional | random | using |
const_cast | future | ratio | utility |
csetjmp | initializer_list | regex | valarray |
csignal | inline | reinterpret_cast | vector |
cstdalign | iomanip | scoped_allocator | virtual |
cstdarg | ios | set | wchar_t |
cstdbool | iosfwd | shared_mutex |
Reserved Keywords for Code Generation
abs | fortran | localZCE | rtNaN |
asm | HAVESTDIO | localZCSV | SeedFileBuffer |
bool | id_t | matrix | SeedFileBufferLen |
boolean_T | int_T | MODEL | single |
byte_T |
int8_T | MT | TID01EQ
|
char_T | int16_T | NCSTATES | time_T |
cint8_T | int32_T | NULL | true |
cint16_T | int64_T | NUMST | TRUE |
cint32_T | INTEGER_CODE | pointer_T | uint_T |
creal_T | LINK_DATA_BUFFER_SIZE | PROFILING_ENABLED
| uint8_T |
creal32_T | LINK_DATA_STREAM | PROFILING_NUM_SAMPLES | uint16_T |
creal64_T | localB | real_T | uint32_T |
cuint8_T | localC | real32_T | uint64_T |
cuint16_T | localDWork | real64_T | UNUSED_PARAMETER |
cuint32_T | localP | RT | USE_RTMODEL
|
ERT | localX | RT_MALLOC
| VCAST_FLUSH_DATA |
false | localXdis | rtInf | vector |
FALSE | localXdot | rtMinusInf |
Conventions for Naming Generated files
MATLAB provides platform-specific extensions for MEX files.
Platform | MEX File Extension |
---|---|
Linux® x86-64 | .mexa64 |
Windows® (32-bit) | .mexw32 |
Windows x64 | .mexw64 |