View previous topic :: View next topic |
Author |
Message |
gordonaird
Joined: 25 Nov 2008 Posts: 2 Location: Glasgow
|
Posted: Wed Nov 26, 2008 12:18 pm Post subject: Debugging a C++ DLL from an FTN95 application |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7916 Location: Salford, UK
|
Posted: Wed Nov 26, 2008 1:41 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 444 Location: Manchester
|
Posted: Sun Nov 30, 2008 11:22 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Andrew
Joined: 09 Sep 2004 Posts: 232 Location: Frankfurt, Germany
|
Posted: Mon Dec 08, 2008 12:14 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
gordonaird
Joined: 25 Nov 2008 Posts: 2 Location: Glasgow
|
Posted: Tue Jan 06, 2009 12:11 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
|