- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page