Thanks! I never thought, you could give a DLL another address space. I don't quite understand how it works yet, but i'll look into it.
On Sat, Oct 15, 2011 at 8:15 PM, Walter Bright <[email protected]> wrote: > On 10/15/2011 3:29 AM, Gor Gyolchanyan wrote: >> >> The other day i was re-reading the std.exception docs and stumbled >> upon "It's ill-advised to catch anything, that is not Exception or >> derived from it". >> Can you show me examples when catching a Throwable is a good idea? > > When there's something your program needs to do in order to shut down > gracefully (such as "engage the backup", or "try to save the user's data"), > or if you want to generate a log message before stopping the program. > > Catching it can also be used to shut down a failing subsystem and restart > it. > >> Also, i had some thoughts about catching AcessViolation exception in a >> modular application to avoid my app crashing when a module crashes, >> but i was told, that segfaults indicate a messed up memory and nothing >> is guaranteed to work after a segfault. > > That's true, an access violation means you've got likely got memory > corruption somewhere. > >> My question is, is it true, that segfault means THE END, and if so, >> what's the point in allowing to catch it? > > Debuggers need to catch all seg faults from the debuggee. OS services need > to catch page faults in order to implement demand paged virtual memory, > stack faults in order to extend the stack segment, etc. > >> Also, how do i prevent DLLs from crashing my process like that? > > You'll need to figure out how to run your DLL in a separate address space, > like a debugger would. > >
