Technical Solutions
How can I debug a Fortran MEX file on Windows using Intel, Compaq, or Digial Visual Fortran compilers with Microsoft Visual Studio?
Date Last Modified: Friday, June 26, 2009
| Solution ID: | 1-32VRZ1 | |
| Product: | MATLAB | |
| Reported in Release: | No Release | |
| Platform: | Windows | |
| Operating System: | Windows Any |
Subject:
How can I debug a Fortran MEX file on Windows using Intel, Compaq, or Digial Visual Fortran compilers with Microsoft Visual Studio?
Problem Description:
I would like to debug a Fortran MEX file in Windows.
Solution:This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds: if you are using the Compaq or Digital Visual Fortran compiler, or if you are using Intel Fortran with Microsoft Visual Studio. Note that dfdev brings up the Compaq or Digital Visual Fortran debugger which also use the Microsoft visual development environment. Here <mex-file name> is the name of the mex-file you want to debug, with the appropriate extension. This will start up the compiler. This command will fail if dfdev.exe (or msdev.exe) is not on the system path. If you receive an error message when executing the dfdev command, you will need to add the compiler directories to your system path. You should refer to the compiler documentation for more information on defining the system path for your compiler. 5. In the compiler environment, select Settings from the Project menu. In the dialog box that opens, select the Debug tab. In the edit box labeled Executable for debug session, enter the full path to where the MATLAB executable resides. For example, you would enter $MATLABROOT\bin\win32\matlab.exe (where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing:
matlabroot
at the MATLAB command prompt.)In the edit box labeled Program Arguments, enter The other edit boxes in this dialog box should remain empty. 6. Open the source files by selecting File -> Open. Set a breakpoint on the desired line of code by right clicking with your mouse on the line of code, and selecting Insert/Remove Breakpoint. 7. From the Build menu, select Debug, and click Go. A dialog box will appear that warns you that the MATLAB executable (matlab.exe) does not have debugging information. This is expected, as we do not ship a debug version of MATLAB. Click OK to close this dialog box. 8. A new MATLAB session will start. You should be in the directory where your MEX file is located. Execute your code which calls the MEX file, and you should be running the MEX file in the Microsoft visual development environment. For more information on how to use the debugging features, in the compiler environment, refer to the compiler documentation. |
|
|
Store

