Contenido principal

mexext

Binary MEX filename extension

Description

ext = mexext returns the filename extension for the current platform.

example

extlist = mexext('all') returns the extensions for all platforms.

example

Examples

collapse all

Find the MEX file extension for the system you are currently working on.

ext = mexext
ext = 
'mexa64'

Your results reflect your system.

Get the list of file extensions for supported platforms.

extlist = mexext('all');

The mex command identifies a platform by its arch value, which is the output of the computer('arch') command. For Mac platforms, the value is maca64.

Search the arch field in extlist for 'maca64', and display the corresponding ext field.

for k=1:length(extlist)
   if strcmp(extlist(k).arch, 'maca64')
   disp(sprintf('Arch: %s  File Extension: %s', extlist(k).arch, extlist(k).ext))
   end
end
Arch: maca64  File Extension: mexmaca64

Output Arguments

collapse all

Filename extension for MEX file, returned as one of these values.

MEX File Platform-Dependent Extension

PlatformBinary MEX File Extension

Windows®

mexw64

Linux®

mexa64

macOS with Apple silicon

mexmaca64

All filename extensions, returned as a structure with these fields:

Platform, returned as a character vector. The name of the platform is the output of the computer('arch') command.

File extension, returned as a character vector.

Tips

  • To use the MEX filename extension in makefiles or scripts outside MATLAB®, type one of the following from the system command prompt. The script is located in the matlabroot\bin folder.

    • mexext.bat—Windows platform.

    • mexext.sh—UNIX® platform.

      For example, the following commands are in a GNU® makefile.

      ext = $(shell mexext)
      yprime.$(ext) : yprime.c 
      		mex yprime.c

Extended Capabilities

expand all

Version History

Introduced before R2006a

expand all

See Also

|