|
My general aim is to run a Fortran function from Matlab for the validation of my PhD work. This function implements a spline regression model of Friedman's MARS (netlib.org). I started with a conversion to C using the f2c tool(netlib.org). Then I put the mexFunction in the resulting c-file to access it from Matlab. I also added the include mex.h as the first line (before the include f2c.h command which is needed by the conversion tool).
My problem is a failed mex run. With the Fortran libs LIBF77.lib and LIBI77.lib included, I get the output below. I'm really stuck here, seems to have some problems with missing or interfering libs, since it doesn't even knows mxGetValue (though mxGetPr for other variables runs through). Any idea why or how to go around?
Thank you very much, Roland
>> mex MexMars.c -argcheck -v
This is mex, Copyright 1984-2006 The MathWorks, Inc.
-> Default options filename found in C:\Documents and Settings\neumann\Application Data\MathWorks\MATLAB\R2007a
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\neumann\Application Data\MathWorks\MATLAB\R2007a\mexopts.bat
MATLAB = C:\PROGRA~1\_Rol\Mess\Matlab07
-> COMPILER = lcc
-> Compiler flags:
COMPFLAGS = -c -Zp8 -I"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup
OPTIMFLAGS = -DNDEBUG
DEBUGFLAGS = -g4
arguments = -DARGCHECK
Name switch = -Fo
-> Pre-linking commands =
-> LINKER = lcclnk
-> Link directives:
LINKFLAGS = -tmpdir "." -dll "C:\PROGRA~1\_Rol\Mess\Matlab07\extern\lib\win32\lcc\mexFunction.def" -L"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\lib" -libpath "C:\PROGRA~1\_Rol\Mess\Matlab07\extern\lib\win32\lcc" C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\templib2.obj
LINKDEBUGFLAGS =
LINKFLAGSPOST = libmx.lib libmex.lib libmat.lib LIBF77.lib LIBI77.lib
Name directive = -o "MexMars.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = lrc -I"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\include" -noregistrylookup -fo"mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> "lcc -DARGCHECK -c -Zp8 -I"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\MexMars.obj -IC:\PROGRA~1\_Rol\Mess\Matlab07\extern\include -IC:\PROGRA~1\_Rol\Mess\Matlab07\simulink\include -DNDEBUG -DMX_COMPAT_32 MexMars.c"
Warning MexMars.c: 10095 missing return value
Warning MexMars.c: 12866 possible usage of tt before definition
Warning MexMars.c: 13046 assignment of pointer to float to pointer to double
Warning MexMars.c: 13099 assignment of pointer to float to pointer to double
Warning MexMars.c: 13100 assignment of pointer to int to pointer to double
Warning MexMars.c: 13101 assignment of pointer to float to pointer to double
Warning MexMars.c: 13103 assignment of pointer to int to pointer to double
Warning MexMars.c: 13027 local `pointer to float pred' is not referenced
Warning MexMars.c: 13026 local `int size' is not referenced
Warning MexMars.c: 13021 local `pointer to float sp2' is not referenced
0 errors, 10 warnings
--> "lcc -DARGCHECK -c -Zp8 -I"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\mwdebug.obj -IC:\PROGRA~1\_Rol\Mess\Matlab07\extern\include -IC:\PROGRA~1\_Rol\Mess\Matlab07\simulink\include -DNDEBUG -DMX_COMPAT_32 C:\PROGRA~1\_Rol\Mess\Matlab07\extern\src\mwdebug.c"
Warning C:\PROGRA~1\_Rol\Mess\Matlab07\extern\src\mwdebug.c: 600 missing return value
Warning C:\PROGRA~1\_Rol\Mess\Matlab07\extern\src\mwdebug.c: 628 missing return value
Warning C:\PROGRA~1\_Rol\Mess\Matlab07\extern\src\mwdebug.c: 1088 missing return value
0 errors, 3 warnings
--> "lcc -c -Zp8 -I"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup "C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\mex\lccstub.c" -FoC:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\templib2.obj"
Contents of C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\mex_tmp.rsp:
C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\MexMars.obj C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\mwdebug.obj
--> "lcclnk -o "MexMars.mexw32" -tmpdir "." -dll "C:\PROGRA~1\_Rol\Mess\Matlab07\extern\lib\win32\lcc\mexFunction.def" -L"C:\PROGRA~1\_Rol\Mess\Matlab07\sys\lcc\lib" -libpath "C:\PROGRA~1\_Rol\Mess\Matlab07\extern\lib\win32\lcc" C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\templib2.obj -s @C:\DOCUME~1\neumann\LOCALS~1\Temp\mex_8463603B-7A8A-460E-1A9D-C24A3CBFBF28\mex_tmp.rsp libmx.lib libmex.lib libmat.lib LIBF77.lib LIBI77.lib"
Writing library for MexMars.mexw32
c:\docume~1\neumann\locals~1\temp\mex_8463603b-7a8a-460e-1a9d-c24a3cbfbf28\mexmars.obj .text: undefined reference to '_mxGetValue'
c:\docume~1\neumann\locals~1\temp\mex_8463603b-7a8a-460e-1a9d-c24a3cbfbf28\mexmars.obj .text: undefined reference to '_max2'
c:\docume~1\neumann\locals~1\temp\mex_8463603b-7a8a-460e-1a9d-c24a3cbfbf28\mexmars.obj .text: undefined reference to '_max3'
.text: undefined reference to '__imp__floor'
.text: undefined reference to '__imp___iob'
.text: undefined reference to '__imp__fprintf'
.text: undefined reference to '__imp__putc'
.text: undefined reference to '__imp__exit'
.text: undefined reference to '__imp___errno'
.text: undefined reference to '__imp__fseek'
.text: undefined reference to '_sig_die'
.text: undefined reference to '__imp__fflush'
.text: undefined reference to '__imp__free'
.text: undefined reference to '__imp__remove'
.text: undefined reference to '__imp__fileno'
.text: undefined reference to '_isatty'
.text: undefined reference to '__imp__perror'
.text: undefined reference to '__imp__ftell'
.text: undefined reference to '__imp__freopen'
.text: undefined reference to '_open'
.text: undefined reference to '_close'
.text: undefined reference to '__imp__strncmp'
.text: undefined reference to '_access'
.text: undefined reference to '_mktemp'
.text: undefined reference to '__imp__fopen'
.text: undefined reference to '__imp__rewind'
.text: undefined reference to '__imp__fread'
.text: undefined reference to '__imp__fwrite'
.text: undefined reference to '__imp____mb_cur_max'
.text: undefined reference to '__imp___isctype'
.text: undefined reference to '__imp___pctype'
.text: undefined reference to '__imp__atoi'
C:\PROGRA~1\_ROL\MESS\MATLAB07\BIN\MEX.PL: Error: Link of 'MexMars.mexw32' failed.
??? Error using ==> mex at 206
Unable to complete successfully.
|