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

Exception Handling

hweisberg
Beginner
368 Views
We have a project structured as about 160 DLLs produced from 300,000 lines of legacy Fortran code, coupled to a new user interface and database management system written in managed code using Windows.NET. The managed code calls into the DLLs using Platform Invoke.

When a Fortran DLL throws an exception, the exception bubbles up and is caught by the .NET code that called the DLL. Unfortunately, there is no stack trace. There is not even information on the address where the exception was thrown.

From reading the documentation in CVF about exception handling, I believe it should be possible to write a C or Assembly wrapper for each DLL that would implement Structured Exception Handling and allow a stack trace to bubble up to the calling program.

Has anyone done this, or can anyone describe how to do it, or can anyone give a reference to appropriate documentation?
0 Kudos
1 Reply
rahzan
New Contributor I
368 Views
The C-wrapper idea is shown in 2 samples called: CSLEXCP2 and CSLEXCP4.

I have a sample project based on these which does the same for a F90 app calling a f90 DLL via a c-wrapper.

But none of these apply to you since the caller is not f90. I can provide the latter sample if you like to see it.

Also a guess: you probably will not get the stacktrace info unless you've compiled your f90 dlls with /traceback

as well as (methinks): /check:[option].

tim
0 Kudos
Reply