- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a CVF/Windows dll that implements exception handling using the "C Wrapper" seh technique, which works fine except:
If a divide by zero triggers the C exception handler, a work file I had open in the Fortran dll cannot be deleted by the C++ wrapper function or even the routine that calls the wrapper (even after unloading the dll). It is unavailable to another instance of the CVF dll. Nor can it be deleted through the OS GUI, until the whole calling program exits.
CVF/Windows must be protecting the file. I would like to be able to programatically delete this work file after the exception so the dll can be called again with other data (without exiting and restarting the whole program).
Any ideas on freeing the file up from the wrapper function or above?
Thanks for your thoughts.
If a divide by zero triggers the C exception handler, a work file I had open in the Fortran dll cannot be deleted by the C++ wrapper function or even the routine that calls the wrapper (even after unloading the dll). It is unavailable to another instance of the CVF dll. Nor can it be deleted through the OS GUI, until the whole calling program exits.
CVF/Windows must be protecting the file. I would like to be able to programatically delete this work file after the exception so the dll can be called again with other data (without exiting and restarting the whole program).
Any ideas on freeing the file up from the wrapper function or above?
Thanks for your thoughts.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not that CVF is "protecting" the file, but that it does not establish handlers to close the file upon an unload of the DLL. (It would be wrong to do it for an exception.) Add a routine to the DLL to close the work files and call it from your exception code.
STeve
STeve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve,
You were correct; the trick was that the files had to be deleted with FORTRAN code rather than the C++ code of the exception handler.
You were correct; the trick was that the files had to be deleted with FORTRAN code rather than the C++ code of the exception handler.

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