Setting Up File Infrastructure and Paths

Compile Path Search Order

Embedded MATLAB MEX resolves M-functions by searching first on the Embedded MATLAB path and then on the MATLAB path. See How the Embedded MATLAB Subset Resolves Function Calls in the Embedded MATLAB documentation.

Can I Add Files to the Embedded MATLAB Path?

With Embedded MATLAB MEX, you can prepend directories and files to the Embedded MATLAB path, as described in Adding Directories to Search Paths. By default, the Embedded MATLAB path contains the current directory and the Embedded MATLAB libraries.

When to Use the Embedded MATLAB Path

Use the Embedded MATLAB path to override a MATLAB function with a customized version. Since Embedded MATLAB MEX searches the Embedded MATLAB path first, an M-file on the Embedded MATLAB path always shadows an M-file of the same name on the MATLAB path. To override a MATLAB function with a version implemented in Embedded MATLAB libraries, follow these steps:

  1. Create each version of the M-function in identically-named M-files.

  2. Add the MATLAB version to the MATLAB path.

  3. Add the Embedded MATLAB version to the Embedded MATLAB path.

    See Adding Directories to Search Paths.

Adding Directories to Search Paths

The following table explains how to add directories to search paths:

To add directories to: Do this:
Embedded MATLAB pathPrepend directories to the Embedded MATLAB path using the compiler option -I. See -I Add Directories to Embedded MATLAB Path using emlmex.
MATLAB pathFollow the instructions in Adding a Directory to the Search Path in the MATLAB Programming documentation.

Naming Conventions

Embedded MATLAB MEX enforces naming conventions for M-functions and generated files.

Reserved Prefixes

The Embedded MATLAB subset reserves the prefix eml for global C functions and variables in generated code. For example, Embedded MATLAB runtime library function names all begin with the prefix emlrt, such as emlrtCallMATLAB. To avoid naming conflicts, do not name C functions or primary M-functions with the prefix eml.

Conventions for Naming Generated files

Embedded MATLAB MEX follows MATLAB conventions by providing platform-specific extensions for C-MEX files.

PlatformMEX File Extension
Linux® (32-bit).mexglx
Linux x86-64.mexa64
Windows (32-bit).mexw32
Windows x64.mexw64

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS