Skip to Main Content Skip to Search
Product Documentation

mex.getCompilerConfigurations - Get compiler configuration information for building MEX-files

Syntax

cc = mex.getCompilerConfigurations()
cc = mex.getCompilerConfigurations('lang')
cc = mex.getCompilerConfigurations('lang','list')

Description

cc = mex.getCompilerConfigurations() returns a mex.CompilerConfiguration object cc containing information about the selected compiler configuration used by mex. The selected compiler is the one you choose when you run the mex -setup command. For details about the mex.CompilerConfiguration class, see mex.CompilerConfiguration.

cc = mex.getCompilerConfigurations('lang') returns an array of mex.CompilerConfiguration objects cc containing information about the selected configuration for the given lang. If the language of the selected complier is different from lang, then cc is empty.

Language lang is a string with one of the following values:

cc = mex.getCompilerConfigurations('lang','list') returns an array of mex.CompilerConfiguration objects cc containing information about configurations for the given language and the given list. Values for list are:

Classes

mex.CompilerConfiguration

The mex.CompilerConfiguration class contains the following read-only properties about compiler configurations.

PropertyPurpose
NameName of the compiler
ManufacturerName of the manufacturer of the compiler
LanguageCompiler language
Version(Windows platforms only) Version of the compiler
Location(Windows platforms only) Folder where compiler is installed
DetailsA mex.CompilerConfigurationDetails object containing specific information about build options. For details about this class, see mex.CompilerConfigurationDetails.

mex.CompilerConfigurationDetails

The mex.CompilerConfigurationDetails class provides information about the command options used by the compiler, linker and other build programs used to create MEX-files. These properties are read-only.

Property
CompilerExecutable
CompilerFlags
OptimizationFlags
DebugFlags
LinkerExecutable
LinkerFlags
LinkerOptimizationFlags
LinkerDebugFlags

Examples

Selected Compiler Example

myCompiler = mex.getCompilerConfigurations()

MATLAB software displays information similar to the following (depending on your architecture, your version of MATLAB, and what you selected when you ran mex -setup):

myCompiler = 

  mex.CompilerConfiguration
  Package: mex

  Properties:
            Name: 'Microsoft Visual C++ 2005'
    Manufacturer: 'Microsoft'
        Language: 'C++'
         Version: '8.0'
        Location: '%VS80COMNTOOLS%\..\..'
         Details: [1x1 mex.CompilerConfigurationDetails]

  Methods

Supported Compiler Configurations Example

allCC = mex.getCompilerConfigurations('Any','Supported')

MATLAB displays information similar to the following:

allCC = 

  1x11 mex.CompilerConfiguration
  Package: mex

  Properties:
    Name
    Manufacturer
    Language
    Version
    Location
    Details

  Methods

This version of MATLAB supports eleven configurations, hence, allCC is a 1-by-11 matrix.

Supported C Compilers Example

To see what C compilers MATLAB supports, type:

cLanguageCC = mex.getCompilerConfigurations('C','Supported')

MATLAB displays the following information (the number of compilers for your version of MATLAB may be different):

cLanguageCC = 

  1x9 mex.CompilerConfiguration
  Package: mex

  Properties:
    Name
    Manufacturer
    Language
    Version
    Location
    Details

  Methods

To display the compiler names, type:

format compact
cLanguageCC.Name

MATLAB displays information similar to the following:

ans =
Intel C++
ans =
Lcc-win32
ans =
Microsoft Visual C++
ans =
Microsoft Visual C++ 2003
ans =
Microsoft Visual C++ 2005 Express Edition
ans =
Microsoft Visual C++ 2005
ans =
Microsoft Visual C++ 2008
ans =
Open WATCOM C/C++ 

Example — Viewing Build Options for a C Compiler

To see what build options MATLAB uses with a particular C compiler, create an array CC of all supported C compiler configurations:

CC = mex.getCompilerConfigurations('C','Supported');
disp('Compiler Name')
for i = 1:3; disp(CC(i).Name); end;

MATLAB displays a list similar to:

Intel C++
Lcc-win32
Microsoft Visual C++

To see the build options for the Microsoft Visual C++ compiler, type:

CC(3).Details

MATLAB displays information similar to the following (output is formatted):

ans = 
  mex.CompilerConfigurationDetails
  Package: mex

  Properties:
         CompilerExecutable: 'cl'
              CompilerFlags: '-c -Zp8 -G5 -W3 -EHs 
                             -DMATLAB_MEX_FILE -nologo /MD'
          OptimizationFlags: '-O2 -Oy- -DNDEBUG'
                 DebugFlags: '-Zi 
                             -Fd"%OUTDIR%%MEX_NAME%.pdb"'
           LinkerExecutable: 'link'
                LinkerFlags: [1x258 char]
    LinkerOptimizationFlags: ''
           LinkerDebugFlags: '/debug'
  Methods

See Also

mex

  


» Learn more
» Download free kit
» Get trial software

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