On Wednesday, 14 September 2011 at 12:16:02 UTC, Steven
Schveighoffer wrote:
In any case, have you tried this? Works on unixen only.
import core.stdc.signal;
extern(C) void handleSegv(int) { assert(0); }
void main()
{
signal(SIGSEGV, &handleSegv);
...
}
Not sure if it prints a stack trace on a stack overflow,
however.
-Steve
Update for anyone reading this old thread:
You need to add `nothrow @nogc @system` to `handleSegv`.
```
import core.stdc.signal;
nothrow @nogc @system
extern(C) void handleSegv(int) { assert(0); }
shared static this() {
signal(SIGSEGV, &handleSegv);
}
```
This answer worked great for me.