Why do my MEX-files, that were created with MATLAB 5.3.x, no longer run in MATLAB 6.0 (R12)?

1 view (last 30 days)
When running older MEX-files in MATLAB 6.0, I get errors regarding unresolved external symbol mexFunction. I tried rebuilding the code with the new versions of MATLAB and the Compiler within Microsoft Visual Studio 6.0 and get the following errors:
Test.def : error LNK2001: unresolved external symbol mexFunction
Release/Test.lib : fatal error LNK1120: 1 unresolved externals
LINK : fatal error LNK1141: failure during build of exports file
Error executing link.exe.
The .def file contains the following:
LIBRARY Test.dll
EXPORTS mexFunction
The MEX, C and h files and stubs were built using:
mcc -t -L C -W mex Test.m
The following 2 pre-link steps are included in the project settings:
lib /def:"d:\matlabr11\extern\include\matlab.def" /machine:ix86/out:"Release\mymatlab.lib"
lib /def:"d:\matlabr11\extern\include\libmatlbmx.def" machine:ix86/out:"Release\mylibmatlbmx.lib"
These generated lib files are then linked into the project.
All of this is still the same as for R11: I only changed my paths from
"MatlabR11" to "MatlabR12"...

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This problem occurs because we have changed the name of the exported symbol in compiler-generated MEX-files to be "mexLibrary". Please change any MSVC projects that build MEX-files to replace the .def file with one that exports mexLibrary instead of mexFunction.
You will need to change the name of the exported symbol in the .def file to be:
mexLibrary
instead of:
mexFunction

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!