Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Exception logging on Windows

frodoh
Beginner
415 Views

I have a Fortran based DLL hosted in a Windows application.  Is there a mechanism to dump the stack trace to a text file?

My suspicion is that the stack trace is written to standard out or standard error and I am not seeing it in release mode because I have no stdout/stderr.  

0 Kudos
1 Solution
andrew_4619
Honored Contributor II
353 Views

The environment variable "FOR_DIAGNOSTIC_LOG_FILE" can be used to set a log file name.

 

View solution in original post

3 Replies
jimdempseyatthecove
Honored Contributor III
403 Views

You could follow the instructions in: Adding Console I/O to a Win32 GUI App

 

Another (untested) hack (try first):

Launch a CMD window, and then from the command line launch the executable (with necessary arguments). The idea with this is, the parent process is the CMD window, which has a console. The hope would be that the spawned process (your app  using the DLL) would inherit the file handles (console handles).

 

Jim Dempsey

Ron_Green
Moderator
374 Views

And once you have stdout and stderr open, then perhaps the https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/dup-dup2?view=msvc-170

_dup2() function can attach a file to that open file handle.  

andrew_4619
Honored Contributor II
354 Views

The environment variable "FOR_DIAGNOSTIC_LOG_FILE" can be used to set a log file name.

 

Reply