handle exception in dynamically-linked DLL
-
Hello, My Win32 app is calling a procedure stored inside a Dll, using LoadLibrary and GetProcAddress. Most of the time everything works okay. The dll is written in Fortran. The method being called opens a file, reads in data, performs calculations and outputs results in another file. Occasionally the calculations cause a Floating-Point Exception to occur. I don't have access to the Fortran src so I've being trying to catch the exception in the C++ calling code, using C++ exception handling but it doesn't catch. My questions are: 1) is this possible? (can an exception being thrown by a dll linked dynamically at run time be caught? - I could try creating an import library if that's possible.) 2) can anybody give me any clues? Thanks, John
-
Hello, My Win32 app is calling a procedure stored inside a Dll, using LoadLibrary and GetProcAddress. Most of the time everything works okay. The dll is written in Fortran. The method being called opens a file, reads in data, performs calculations and outputs results in another file. Occasionally the calculations cause a Floating-Point Exception to occur. I don't have access to the Fortran src so I've being trying to catch the exception in the C++ calling code, using C++ exception handling but it doesn't catch. My questions are: 1) is this possible? (can an exception being thrown by a dll linked dynamically at run time be caught? - I could try creating an import library if that's possible.) 2) can anybody give me any clues? Thanks, John
I think you need to look at the Win32 Structured Exemption Handling (SEH). I'm sure you'll find articles here on SEH and of course on MSDN. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program
-
I think you need to look at the Win32 Structured Exemption Handling (SEH). I'm sure you'll find articles here on SEH and of course on MSDN. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program
Thanks, Got the answer in Handling Exceptions, Part 17 in MSDN by using a 'Translator Function' to bind SEH to the more friendly C++ Exception handling mechanism. Work's perfectly! John