*To*: mathgroup@smc.vnet.net*Subject*: [mg10430] user's query in comp.soft-sys.math.matheamtica (fwd)*From*: "P.J. Hinton" <paulh@wolfram.com>*Date*: Tue, 13 Jan 1998 02:07:29 -0500*Organization*: "Wolfram Research, Inc."

A MathLink developer in our applications group has forwarded this message to me for posting to comp.soft-sys.math.mathematica/MathGroup. It attempts to address questions raised by a user on how to debug MathLink programs under Windows. -- P.J. Hinton Mathematica Programming Group paulh@wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ ---------- Forwarded message ---------- How can I debug my MathLink programs while they are connected to the kernel? You can do this by launching the program in debug mode in your compiler with the following command line switches: -linkname foo -linkmode listen In Mathematica you will want to connect to this newly running process by issuing the following command: Install["foo", LinkMode->Connect] Now you can run your installed MathLink functions as usual. To examine the execution of any of your routines called by MathLink, just place a breakpoint inside. When you run the installed function from Mathematica, your debugger will hit the breakpoint and you'll be able to step through execution and examine variables as you would for any other program. In Mathematica 3.0 for Windows there is a known problem that doesn't allow you to reuse linknames (i.e. "foo" in the above example) while the FileMap protocol is in memory. You can get around this problem by either restarting the kernel each time you need to debug the program or by choosing a different linkname ("foo1", "foo2", etc) each time you launch the program in your debugger. This will be a added to the Technical Support FAQ pages at URL: http://www.wolfram.com/support/