Prev: plotregion
Next: how to send keyboard event
From: James Tursa on 29 Dec 2009 02:47 Also, can you just compile a do-nothing mex routine and see if it runs? e.g., #include "fintrf.h" subroutine mexFunction(nlhs, plhs, nrhs, prhs) mwPointer plhs(*), prhs(*) integer*4 nlhs, nrhs return end subroutine mexFunction James Tursa
From: HIEU on 29 Dec 2009 11:37 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hhcc05$70r$1(a)fred.mathworks.com>... > "HIEU " <nguyenhuyhieu(a)gmail.com> wrote in message <hhbjm1$r6o$1(a)fred.mathworks.com>... > > > > I tried the mex file, it compiled but when I ran it with: > > >> A = floor(rand(3,3,3)*99); > > >> passtest(A) > > > > I got: > > ??? Invalid MEX-file 'C:\Fortran\passtest.mexw32': The specified procedure could not be found. > > That message is typical when you compile a mex routine with one version of MATLAB and try to run it under another version, indicating some type of mismatch in the interface. Are you compiling and running with the same version? > > James Tursa Yes, I am running with the same version R2008a.
From: HIEU on 29 Dec 2009 11:46 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hhcc5m$him$1(a)fred.mathworks.com>... > Also, can you just compile a do-nothing mex routine and see if it runs? e.g., > > #include "fintrf.h" > subroutine mexFunction(nlhs, plhs, nrhs, prhs) > mwPointer plhs(*), prhs(*) > integer*4 nlhs, nrhs > return > end subroutine mexFunction > > James Tursa I got the same error. Do you think there are some problems with my MATLAB, Fortran Compiler, or with the bat files? Hieu
From: James Tursa on 29 Dec 2009 15:59 "HIEU " <nguyenhuyhieu(a)gmail.com> wrote in message <hhdboc$ogg$1(a)fred.mathworks.com>... > "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hhcc5m$him$1(a)fred.mathworks.com>... > > Also, can you just compile a do-nothing mex routine and see if it runs? e.g., > > > > #include "fintrf.h" > > subroutine mexFunction(nlhs, plhs, nrhs, prhs) > > mwPointer plhs(*), prhs(*) > > integer*4 nlhs, nrhs > > return > > end subroutine mexFunction > > > > James Tursa > > I got the same error. Do you think there are some problems with my MATLAB, Fortran Compiler, or with the bat files? > > Hieu Since I know that Intel Fortran compilers work with MATLAB, and I know that the source files I have given you work with Intel Fortran compilers, that leaves the bat files as the most likely culprit. I assume you got these off of the FEX, since MATLAB does not officially support 11.0 yet. Is that true? James Tursa
From: HIEU on 29 Dec 2009 20:06
> Since I know that Intel Fortran compilers work with MATLAB, and I know that the source files I have given you work with Intel Fortran compilers, that leaves the bat files as the most likely culprit. I assume you got these off of the FEX, since MATLAB does not officially support 11.0 yet. Is that true? > > James Tursa Yes, I got these file from FEX. I modified them a bit. Can you take a look at them? 1. intelf11msvs2005opts.stp # $Revision: 1.1.6.1 $ $Date: 2007/12/06 13:15:26 $ # This file updated from the version 10.1 file by Kristjan Jonasson (jonasson(a)hi.is) # It is accompanied by intelf11msvs2005opts.bat and the pair should be copied to # the folder c:\program files\matlab\r20xyz\bin\win32\mexopts. Then mex -setup # should work. NOTE: r20xyz could for example be r2008a or r2008b. sub intelf11msvs2005opts { #=================================================================== # intelf11msvs2005opts: Define where the Intel Visual Fortran # compiler 11.0 is installed. Also sets language, version, and # environment variables. #=================================================================== my $input = shift; # This is where the vendor installs the compiler by default my $default_location = "C:\\Program Files\\Intel\\Compiler\\11.1\\038\\bin\\ia32"; # Return language/technology this compiler compiles. my @language_handled = ('FORTRAN'); # Find MSVC80 my $msvc80_record = callstpfile($input->{'matlab_bin'}."/mexopts/","msvc80opts.stp"); my $msvc80_location_fcn = $msvc80_record->{"locate"}; my @msvc80_locations = &$msvc80_location_fcn; my $msvc80_dir = pop @msvc80_locations; my $locate_fcn = sub { #=================================================================== # locate_fcn: A local function to return potential location where this compiler # is installed. The return value is used to set the COMPILER_ROOT # directory. It makes three guesses: The system path, the registry, and # the default location where the compiler tries to install itself. #=================================================================== my @ifort_roots = (); # Search the default environment variable location. $ifort_root = $ENV{'IFORT_COMPILER11'}; if (-e "$ifort_root\\Bin\\IA32\\ifort.exe"){ if (&correct_version("$ifort_root\\Bin\\IA32\\ifort.exe","11.1")){ push(@ifort_roots, $ifort_root); } } # Search the default install location. # Verify it is the right version and strip part that is not the ROOT. if (-e $default_location . "\\Bin\\IA32\\ifort.exe"){ if (&correct_version($default_location . "\\Bin\\IA32\\ifort.exe","11.1")){ push(@ifort_roots, $default_location); } } return @ifort_roots; }; my $root_val = sub { my $base_directory = shift; if (!$msvc80_dir){ my $errMsg="\nError: Microsoft Visual Studio 2005 was not found by mex -setup.\n" . " The Microsoft Visual Studio 2005 linker is required\n". " to build Intel Fortran MEX-files. Please make sure that\n". " Microsoft Visual Studio 2005 is installed properly.\n\n"; die $errMsg; } return $base_directory; }; return { "vendor_name" => "Intel Visual Fortran", "version" => "11.1", "group_id" => "INTELF", "serial" => 11.1, "root_var" => "IFORT_COMPILER11", "linker_var" => "VS80COMNTOOLS", "optfile_name" => "intelf11msvs2005opts.bat", "linker_optfile_name" => "msvc80opts", "default_location" => $default_location, "language_handled" => \@language_handled, "root_val" => $root_val, "link_val" => $msvc80_dir, "locate" => $locate_fcn, }; } 1; 2. intelf11msvs2005engmatopts.bat @echo off rem INTEL10MSVS2005ENGMATOPTS.BAT rem rem Compile and link options used for building stand-alone engine or rem MAT programs with the Intel® Visual Fortran Compiler 11.0 with the rem Microsoft® Visual Studio® 2005 linker. rem rem This file is updated from the version 10.1 file by Kristjan Jonasson rem (jonasson(a)hi.is). It is accompanied by intelf11msvs2005opts.stp and rem intelf11msvs2005opts.bat, and the three files should be copied to the folder rem c:\program files\matlab\r20xyz\bin\win32\mexopts. Then mex -setup should work rem NOTE: r20xyz could for example be r2008a or r2008b. rem rem $Revision: 1.1.6.1 $ $Date: 2007/12/06 13:15:24 $ rem rem ******************************************************************** rem General parameters rem ******************************************************************** set MATLAB=%MATLAB% set IFORT_COMPILER11=c:\program files\intel\compiler\11.1\038 set VS80COMNTOOLS=%VS80COMNTOOLS% set LINKERDIR=C:\Program Files\Microsoft Visual Studio 8 set PATH=%IFORT_COMPILER11%\Bin\IA32;%LINKERDIR%\VC\BIN;%LINKERDIR%\Common7\Tools;%LINKERDIR%\Common7\Tools\bin;%LINKERDIR%\Common7\IDE;%LINKERDIR%\SDK\v2.0\bin;%PATH% set INCLUDE=%IFORT_COMPILER11%\Include\IA32;%IFORT_COMPILER11%\Include;%LINKERDIR%\VC\ATLMFC\INCLUDE;%LINKERDIR%\VC\INCLUDE;%LINKERDIR%\VC\PlatformSDK\include;%INCLUDE% set LIB=%IFORT_COMPILER11%\Lib\IA32;%LINKERDIR%\VC\ATLMFC\LIB;%LINKERDIR%\VC\LIB;%LINKERDIR%\VC\PlatformSDK\lib;%MATLAB%\extern\lib\win32;%LIB% set MW_TARGET_ARCH=win32 rem ******************************************************************** rem Compiler parameters rem ******************************************************************** set COMPILER=ifort set COMPFLAGS=/fpp /Qprec /I"%MATLAB%/extern/include" /c /nologo /fp:source /MD set OPTIMFLAGS=/Ox /DNDEBUG set DEBUGFLAGS=/Zi /Fd"%OUTDIR%%MEX_NAME%.pdb" set NAME_OBJECT=/Fo rem ******************************************************************** rem Linker parameters rem ******************************************************************** set LIBLOC=%MATLAB%\extern\lib\win32\microsoft set LINKER=link set LINKFLAGS=/LIBPATH:"%LIBLOC%" libmx.lib libmat.lib libeng.lib /nologo /subsystem:console set LINKOPTIMFLAGS= set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%.pdb" /INCREMENTAL:NO set LINK_FILE= set LINK_LIB= set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%.exe" set RSP_FILE_INDICATOR=@ rem ******************************************************************** rem Resource compiler parameters rem ******************************************************************** set RC_COMPILER= set RC_LINKER= set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%.exe";1 -manifest "%OUTDIR%%MEX_NAME%.exe.manifest" set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%.exe.manifest" 3. intelf11msvs2005opts.bat @echo off rem INTELF11MSVS2005OPTS.BAT rem rem Compile and link options used for building MEX-files using the rem Intel® Fortran Compiler 11.1 with the Microsoft® Visual Studio® rem 2005 linker. rem rem This file updated from the version 10.1 file by Kristjan Jonasson (jonasson(a)hi.is) rem It is accompanied by intelf11msvs2005opts.stp and the pair should be copied to rem the folder c:\program files\matlab\r20xyz\bin\win32\mexopts. Then mex -setup rem should work. NOTE: r20xyz could for example be r2008a or r2008b. rem rem StorageVersion: 1.0 rem FortrankeyFileName: INTELF11MSVS2005OPTS.BAT rem FortrankeyName: Intel Visual Fortran rem FortrankeyManufacturer: Intel rem FortrankeyVersion: 11.0 rem FortrankeyLanguage: Fortran rem rem $Revision: 1.1.6.1 $ $Date: 2007/12/06 13:15:25 $ rem rem ******************************************************************** rem General parameters rem ******************************************************************** set MATLAB=%MATLAB% set IFORT_COMPILER11=c:\program files\intel\compiler\11.1\038 set VS80COMNTOOLS=%VS80COMNTOOLS% set LINKERDIR=C:\Program Files\Microsoft Visual Studio 8 set PATH=%IFORT_COMPILER11%\Bin\ia32;%LINKERDIR%\VC\BIN;%LINKERDIR%\Common7\Tools;%LINKERDIR%\Common7\Tools\bin;%LINKERDIR%\Common7\IDE;%LINKERDIR%\SDK\v2.0\bin;%PATH% set INCLUDE=%IFORT_COMPILER11%\Include\ia32;%IFORT_COMPILER11%\Include;%LINKERDIR%\VC\ATLMFC\INCLUDE;%LINKERDIR%\VC\INCLUDE;%LINKERDIR%\VC\PlatformSDK\include;%INCLUDE% set LIB=%IFORT_COMPILER11%\Lib\IA32;%LINKERDIR%\VC\ATLMFC\LIB;%LINKERDIR%\VC\LIB;%LINKERDIR%\VC\PlatformSDK\lib;%MATLAB%\extern\lib\win32;%LIB% set MW_TARGET_ARCH=win32 rem ******************************************************************** rem Compiler parameters rem ******************************************************************** set COMPILER=ifort set COMPFLAGS=/fpp /Qprec "/I%MATLAB%/extern/include" -c -nologo -DMATLAB_MEX_FILE /MD /fp:source set OPTIMFLAGS=-Ox -DNDEBUG set DEBUGFLAGS=/Z7 set NAME_OBJECT=/Fo rem ******************************************************************** rem Linker parameters rem ******************************************************************** set LIBLOC=%MATLAB%\extern\lib\win32\microsoft set LINKER=link set LINKFLAGS=/DLL /EXPORT:MEXFUNCTION /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map" /NOLOGO /INCREMENTAL:NO set LINKOPTIMFLAGS= set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb" set LINK_FILE= set LINK_LIB= set NAME_OUTPUT="/out:%OUTDIR%%MEX_NAME%%MEX_EXT%" set RSP_FILE_INDICATOR=@ rem ******************************************************************** rem Resource compiler parameters rem ******************************************************************** set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res" set RC_LINKER= set POSTLINK_CMDS=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map" set POSTLINK_CMDS1=del "%LIB_NAME%.x" "%LIB_NAME%.exp" set POSTLINK_CMDS2=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%";2 -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest" Did you see anything wrong? Thanks, Hieu |