Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

External Interfaces/API, MATLAB Version 7.7 (R2008b)

Do Not Use DLL File Extensions for MEX-Files

In the future, on 32-bit Microsoft Windows systems, MATLAB will not support MEX-files with a .dll file extension. In MATLAB Version 7.7 (R2008b), if you run a MEX-file with a .dll file extension, MATLAB displays a warning.

Additionally, if you use the mex function with the -output switch to create a MEX-file with a .dll extension, MATLAB displays a warning. If you use the -output switch to name a MEX-file, you do not need to provide a file extension. MATLAB automatically appends the appropriate extension. For example, the following command creates a MEX-file named newtest.mexw32:

mex mytest.c -output newtest

Compatibility Considerations

You must recompile MEX-files with a .mexw32 file extension. This is the default of the mex command.

MEX-Files Must Be Recompiled When -largeArrayDims Becomes Default MEX Option

In a future version of MATLAB, the default mex command will change to use the large-array-handling API. This means the -largeArrayDims option will be the default. For information about migrating your MEX-files to use the large-array-handling API, see the Technical Support solution 1-5C27B9.

Compatibility Considerations

In the near future you will be required to update your code to use the new API and to recompile your MEX-files. You should review your source MEX-files and mex build scripts.

New Compiler Support

MATLAB Version 7.7 (R2008b) supports these new compilers for building MEX-files:

Microsoft Windows 64-bit and 32-bit Platforms

Compiler Support to Be Phased Out

The following compilers are supported in Version 7.7 (R2008b), but will not be supported in a future version of MATLAB.

Windows (32-bit) platform

Windows (64-bit) platforms

Solaris SPARC (64-bit) platform

Use mxDestroyArray to Release Memory for mxArray

The documentation for the mxSetCell, mxSetField, and mxSetFieldByNumber functions in the MATLAB C and Fortran API incorrectly instructs customers to use mxFree to release memory for any mxArray returned by mxGetCell, mxGetField, or mxGetFieldByNumber.

Compatibility Considerations

The correct function to use to release memory for an mxArray is mxDestroyArray. Calling mxFree on an mxArray only frees the array header, but does not actually free the data itself and can result in a memory leak.

To help diagnose this problem, MATLAB issues a warning if calling mxFree on an mxArray could cause memory corruption. In future versions of MATLAB, this condition might result in a segmentation violation.

New Function Displays Information about MEX Compiler Configurations

The mex.getCompilerConfigurations function displays information about the selected compiler and associated switches and options that MATLAB uses to build a MEX-file. The selected compiler is the one you choose when you run the mex -setup command. For more information, see Building MEX-Files.

New Functions to Catch Errors in MEX-Files Replace mexSetTrapFlag

Two new MEX library functions have been added to the MATLAB C and Fortran API.

The mexCallMATLABWithTrap function, like mexCallMATLAB, lets you call M-code from within a MEX-file. In addition, mexCallMATLABWithTrap lets you catch, or trap, errors. Using this function for exception handling is more flexible that using mexCallMATLAB with the mexSetTrapFlag function.

Likewise, the mexEvalStringWithTrap function adds error handling to the mexEvalString function.

Compatibility Considerations

In the near future you will be required to update your MEX-files to remove use of the mexSetTrapFlag function.

"Duplicate dylib" Warning on Macintosh Systems

When compiling MEX-files on an Apple Mac OS Version 10.5 system you can ignore a warning about a duplicate library libz.1.dylib. The MEX-file builds properly and runs as expected. The warning message contains the following information:

ld: warning, duplicate dylib

Microsoft Visual Studio "X64 Compilers and Tools" Required for 64-bit Systems

If you use Microsoft Visual Studio with MATLAB on 64-bit systems, you must choose "X64 Compilers and Tools" when you install the following products:

Run-Time Libraries Required for Applications Built with Microsoft Visual Studio 2008 Compiler

If you distribute a MEX-file, an engine application, or a MAT-file application built with the Visual Studio 2008 compiler, you must provide the Visual C++ run-time libraries. These files are required to run applications developed with Visual C++ on a computer that does not have Visual C++ 2008 installed. For information on locating the Microsoft Visual C++ 2008 Redistributable Package (x86), containing vcredist_x86.exe and vcredist_x64.exe, consult your Microsoft documentation.

Do Not Use get or set Function to Manage Properties of Java Objects

If you want to read or update a property of a Sun Java object created in MATLAB using the Java class constructor, do not use the MATLAB get or set functions on the property. For example, if you create a Java object called javaObject that has a property called PropertyName, the following commands might cause memory leaks and will be deprecated in a future version of MATLAB:

propertyValue = get(javaObject, 'PropertyName'); 
set(javaObject, 'PropertyName', newValue);

Compatibility Considerations

In future versions of MATLAB, using get or set on Java objects to manage the properties will generate an error. The correct commands to use are:

propertyValue = javaObject.getPropertyName;
javaObject.setPropertyName(newValue);

COM Objects Might Display Different Number of Supported Events

If you use events from COM servers implementing event interface versioning, COM objects created with MATLAB Version 7.4 (R2007a), Version 7.5 (R2007b), or Version 7.6 (R2008a) might have a different number of supported events than COM objects created with MATLAB Version 7.7 (R2008b) or any version prior to 7.4.

Compatibility Considerations

Calling the events (COM) function on affected types of COM server components returns a list of events for the latest [default] interface version which might be different from the list of events displayed by MATLAB Version 7.4, Version 7.5, or Version 7.6.

If an event in an older COM event interface version is no longer supported or renamed in the newer interface version, the registerevent function generates an error when such an event is used in M-code.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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