External Interfaces/API |
|
Debugging on Windows
The following sections provide instructions on how to debug on Microsoft Windows systems using various compilers.
Microsoft Compiler
If you are using the Microsoft compiler:
- Start the Microsoft Visual Studio (Version 5 or 6) by typing at the DOS prompt
- msdev
filename
.dll
- In the Microsoft environment, from the Project menu, select Settings. In the window that opens, select the Debug tab. This options window contains edit boxes. In the edit box labeled Executable for debug session, enter the full path to where MATLAB resides. All other edit boxes should be empty.
- Open the source files and set a break point on the desired line of code by right-clicking with your mouse on the line of code.
- From the Build menu, select Debug, and click Go.
- You will now be able to run your MEX-file in MATLAB and use the Microsoft debugging environment. For more information on how to debug in the Microsoft environment, see the Microsoft Development Studio or Microsoft Visual Studio documentation.
Watcom Compiler
If you are using the Watcom compiler:
- Start the debugger by typing on the DOS command line
WDW
- The Watcom Debugger starts and a New Program window opens. In this window type the full path to MATLAB. For example,
c:\matlab\bin\matlab.exe
Then click OK.
- From the Break menu, select On Image Load and type the name of your MEX-file DLL in capital letters. For example,
YPRIME
Then select ADD and click OK to close the window.
- From the Run menu, select GO. This should start MATLAB.
- When MATLAB starts, in the command window change directories to where your MEX-file resides and run your MEX-file. If a message similar to the following appears, ignore the message and click OK.
LDR: Automatic DLL Relocation in matlab.exe
LDR: DLL filename.dll base <number> relocated due to collision with matlab.exe
- Open the file you want to debug and set breakpoints in the source code.
| Debugging on UNIX | | Creating Fortran MEX-Files | |