External Interfaces/API, MATLAB Version 7.1 (R14SP3)

mex Switches Now Supported on Microsoft Windows

MATLAB now supports the -l and -L options to the mex command on Windows operating systems. In previous releases of MATLAB, these options were supported only on UNIX[1] systems.

Switch

Description

-l

Specifies additional libraries to link against.

    Note   On Windows operating systems, the -l option can specify libraries of two forms. For example, specifying -l name matches either name.lib or libname.lib, whereas on UNIX it matches only libname.lib.

-L

Specifies a path to use when MATLAB searches for library files specified with the -l option. The -L option must precede the -l option.

For the switches you can use with the mex command, see the MEX Script Switches table in the Custom Building MEX-Files section of Calling C and Fortran Programs from MATLAB Command Line in the MATLAB External Interfaces documentation.

New COM Programmatic Identifier

There is now a ProgID that enables you to use the full desktop version of MATLAB as an automation server.

Matlab.Desktop.Application starts an automation server using the most recent version of MATLAB that is installed on your system.

New File Extension for MEX-Files on Windows Systems

MATLAB now uses the extension .mexw32 for MEX-files on 32-bit versions of Windows systems. In previous versions, MATLAB used the extension .dll.

The MathWorks recommends that you recompile all MEX-files after installing MATLAB 7.1. MEX-files compiled in MATLAB 7.0.4 with .dll extensions should still work in MATLAB 7.1.

There may be two MEX-files with the same name, except that one has a .mexw32 extension and the other has a .dll extension. When these files are both on the MATLAB search path:

If you want one of these two files to take precedence over the other, ensure that the directory that contains the file you want MATLAB to use is higher on the search path than the directory that contains the file you do not want MATLAB to use.

Compatibility Considerations

Previous versions of MATLAB do not recognize MEX-files compiled in MATLAB 7.1 with .mexw32 extensions. However, you can use the mex -output option in MATLAB 7.1 to build a MEX-file with a .dll extension that earlier versions of MATLAB can recognize.

You may need to update any M-files or makefiles that explicitly expect .dll extensions for compiled MEX-files. You can use the mexext function in MATLAB to obtain the extension for the platform and version you are working on. A new mexext script obtains the appropriate extension when executed from outside MATLAB, as in a makefile.

On Windows systems, MATLAB issues warnings at MEX setup time, compile time, and run-time to notify you of possible incompatibilities resulting from the change in MEX-file extension from .dll to .mexw32.

New mex–output Behavior for Compatibility

The -output option to mex specifies the filename of the compiled MEX-file. In general, mex ignores any filename extension supplied in the -output argument and uses the extension for the compiled file that is appropriate for the architecture. However, on Windows systems, if the -output argument specifies a .dll extension, the compiled file has this extension instead of .mexw32. Previous versions of MATLAB can recognize the resulting compiled file.

Conflicting MEX-Files Renamed Automatically

If two files with the same name but with .mexw32 and .dll extensions exist in the same directory, MATLAB uses the .mexw32 file. To avoid unintended shadowing, MATLAB automatically renames compiled MEX-files under the following circumstances:

New Return Value for mexext on Windows Systems

On 32-bit Windows platforms, the mexext function now returns mexw32. In MATLAB 7.0.4 it returned dll.

New mexext Script to Obtain MEX-File Extension in Makefiles

A new script displays the MEX-file extension in the current version of MATLAB that corresponds to the platform on which the script is executed. It is intended to be used outside MATLAB, in makefiles or scripts, to obtain the appropriate filename extension for compiled MEX-files. Use this script instead of explicitly specifying the MEX-file extension in a makefile.

The script is named mexext.bat on Windows platforms and mexext.sh on UNIX platforms. It is located in the directory $matlab/bin, where $matlab represents the string returned from the matlabroot command.

The script displays the MEX-file extension without a leading period. For example, on 32-bit Windows platforms, it returns mexw32.

Following is a fragment of a GNU makefile that uses the mexext script to obtain the MEX-file extension:

ext = $(shell mexext)

yprime.$(ext) : yprime.c 
	mex yprime.c

New Preferences Directory and MEX Options

The MATLAB preferences directory has changed. In MATLAB 7.1, the preferences directory is named R14SP3. In previous R14 releases, the preferences directory was named R14. For more information, see the documentation for prefdir, which returns the preferences directory.

Compatibility Considerations

When you install MATLAB 7.1, MATLAB migrates some files from any existing R14 preferences directory to the new R14SP3 directory. However, MATLAB does not migrate the MEX options file, mexopts.bat. If you want to preserve any MEX options that you have customized in an earlier R14 release, you need to migrate your options to the new R14SP3 preferences directory.

You can migrate your MEX options in either of two ways:

The LIBLOC parameter has changed because import libraries have moved; see Import Libraries Moved. The value of this parameter depends on the platform you are running MATLAB on and the vendor of the compiler you are using.

The NAME_OUTPUT parameter has changed because the extension for compiled MEX-Files has changed on Windows systems; see New File Extension for MEX-Files on Windows Systems.

Compiler Support

The set of compilers that MATLAB supports has changed in MATLAB 7.1. For an up-to-date list of supported compilers, see Technical Note 1601.

Compatibility Considerations

You may need to recompile code compiled with an earlier compiler that is no longer supported.

Import Libraries Moved

The import libraries (.lib files) for the MATLAB dll files have been moved up a directory level and are no longer specific to the compiler version. The new location for these files is

$matlab/extern/lib/$arch/$vendor

where the terms $matlab, $arch, and $vendor respectively represent the string returned from the matlabroot command, the platform you are running MATLAB on, and the vendor of the compiler you are using.

Compatibility Considerations

You may need to change any code that depends on the previous library locations.

MEX Perl Script Moved

The MEX Perl script used in building MEX-files is now located in $matlab/bin, rather than $matlab/bin/win32. (The term $matlab represents the string returned by the matlabroot function.) You should not notice any difference, however, as a batch file located in $matlab/bin/win32 provides backward compatibility.

Linking to System Libraries

MATLAB now links with the system libraries by default. You no longer need to specify them explicitly.

COM Automation Server Now Displays Figure

When using MATLAB as an Automation server, executing MATLAB commands that create figures now displays the figure window.

Previous releases of MATLAB created the figure in the background. To duplicate the old behavior, create a figure with its Visible property set to off, then set the property to on when you want the figure to be visible:

h = actxserver('matlab.application');
h.Execute('figure visible off');
h.Execute('plot(1:10)');
h.Execute('set(gcf,''visible'',''on'')');

[1] UNIX is a registered trademark of The Open Group in the United States and other countries.

  


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