Main Content

Paths and File Infrastructure Setup

Compile Path Search Order

MATLAB® Coder™ resolves MATLAB functions by searching first on the code generation path and then on the MATLAB path. The code generation path contains the current folder and the code generation libraries. By default, unless MATLAB Coder determines that a function should be extrinsic or you explicitly declare the function to be extrinsic, MATLAB Coder tries to compile and generate code for functions it finds on the path. MATLAB Coder does not compile extrinsic functions, but rather dispatches them to MATLAB for execution. See Resolution of Function Calls for Code Generation.

Specify Folders to Search for Custom Code

If you want to integrate custom code — such as source, header, and library files — with the generated code, you can specify additional folder to search. The following table describes how to specify these search paths. The path should not contain:

  • Spaces (Spaces can lead to code generation failures in certain operating system configurations)

  • Tabs

  • \, $, #, *, ?

  • Non-7-bit ASCII characters, such as Japanese characters

To specify additional foldersDo this
Using the MATLAB Coder app
  1. To open the Generate dialog box, on the Generate Code page, click the Generate arrow .

  2. Click More Settings.

  3. On the Paths tab, in the Search paths field, either browse to add a folder to the search path or enter the full path. The search path must not contain spaces.

At the command lineUse the codegen function -I option.

Naming Conventions

MATLAB Coder enforces naming conventions for MATLAB functions and generated files.

Conventions for Naming Generated Files

The following table describes how MATLAB Coder names generated files. MATLAB Coder follows MATLAB conventions by providing platform-specific extensions for MEX files. See MEX Platform Compatibility.

PlatformMEX File ExtensionMATLAB Coder Extension for Static LibraryMATLAB Coder Extension for Shared LibraryMATLAB Coder Executable Extension
Windows® (64-bit).mexw64.lib.dll
Also, generates an import library with a .lib extension that is required for linking against the .dll.
.exe
Linux® (64-bit).mexa64.a.soNone
macOS with Apple silicon (64-bit).mexmaca64.a.dylibNone
macOS with Intel® (64-bit).mexmaci64.a.dylibNone

See Also

Related Topics