Silverfrost Forums

Welcome to our forums

Statements that execute in debug mode only

27 Feb 2025 12:44 #31946

I use FTN95 Win-32 with SDBG. I'm sure this has been brought up before, but I now need a way to branch the execution path depending on whether the code was compiled in release or debug modes. Some compilers handle this with simple special in-code statements, but I can't find anything about how to achieve this in FTN95. Help will be much appreciated.

27 Feb 2025 7:30 #31947

This is one way, with /CFPP on the FTN95 command line...

program main
#ifdef _DEBUG
 print*, 'Debug mode'
#endif
end program
28 Feb 2025 5:28 #31957

Many thanks. That works well, but it seems to require that the specific F90 file in my multi-file project containing the test must itself be compiled (or not) in debug mode. You mentioned other ways. What would be ideal for me is a test in the code that recognizes when SDBG is actually running. Is there anything like this?

28 Feb 2025 9:17 #31958

bstott

I think that the short answer is 'no', there is no such facility in FTN95 or SDBG.

There will be a way to do it via calls to Windows API functions in order to get the parent process but I don't have the details to hand.

Please login to reply.