Silverfrost Forums

Welcome to our forums

Debugging a C++ DLL from an FTN95 application

26 Nov 2008 11:18 #4041

I'm working with Visual Studio (2005). My solution contains two projects, an application written in Fortran and a C++ DLL. Both projects build fine and the application runs okay with the Fortran calling routines defined in the DLL. However, when I step through the Fortran source using the Visual Studio debugger I am not able to step into the C++ routines of the DLL. Is there something I can do to enable this?

Thanks

26 Nov 2008 12:41 #4042

I am not sure about this. The answer may depend on whether you are using the Silverfrost C++ compiler (SCC) or not.

If you are using SCC then make sure you are also using one of the debugging options. Try opening the relevant C++ file in the debugger and setting a manual break point before you run the main application.

In my experience you cannot step into a DLL function directly but in some situations you can set a manual break point in the DLL code and then run to it that way.

As I say, I am not sure about any of this but it may be worth a try.

30 Nov 2008 10:22 #4054

The simple answer is no you cannot step into it if the DLL is built with Visual C++. The reason is that when you debug an FTN95 application you are really using SDBG and it doesn't know anything about Visual C++ debugging. You could try running your program, setting breakpoints in C++ code and then attaching to the process with Visual Studio.

You should be able to debug Salford C/FTN95 seamlessly.

8 Dec 2008 11:14 #4078

Is it not possible to set the C++ DLL project as the startup project in Visual Studio, but change the startup target to the Fortran program in the DLL debugging options? This should use the Fortran exe to startup the debugging session, but should enable you to debug the C DLL. You will not be able to step between the two however.

Edit: I can confirm this does work (at least in Visual Studio 2008). Set the C DLL project to be the startup poroject. Go into the project settings and under:

Configuration Properties → Debugging → Command

Set the path to the Fortran executable. If you set breakpoints within the C code, they then will be hit.

6 Jan 2009 11:11 #4170

Thanks for the help. Setting the DLL as the startup project with the debug target set to the Fortran executable looks like the best solution. You cannot jump between C++ and Fortran but it does mean you can choose what you want to debug for each run. Thanks.

Please login to reply.