External Interfaces Previous page   Next Page

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:

  1. Start the Microsoft Visual Studio (Version 5 or 6) by typing at the DOS prompt
  2. 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.
  3. 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.
  4. From the Build menu, select Debug, and click Go.
  5. 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:

  1. Start the debugger by typing on the DOS command line
  1. WDW

  1. The Watcom Debugger starts and a New Program window opens. In this window type the full path to MATLAB. For example,
  1. c:\matlab\bin\matlab.exe

    Then click OK.

  1. From the Break menu, select On Image Load and type the name of your MEX-file DLL in capital letters. For example,
  1. YPRIME

    Then select ADD and click OK to close the window.

  1. From the Run menu, select GO. This should start MATLAB.
  2. 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.
  1. LDR: Automatic DLL Relocation in matlab.exe
    LDR: DLL filename.dll base <number> relocated due to collision with matlab.exe

  1. Open the file you want to debug and set breakpoints in the source code.

Previous page  Debugging on UNIX Creating Fortran MEX-Files Next page

© 1994-2005 The MathWorks, Inc.