This modules registers a signal handler that turns access violations / segfaults into a NilAccessDefect exception. To be able to catch a NilAccessDefect all you have to do is to import this module.
Tested on these OSes: Linux, Windows, OSX
Procs
proc c_abort() {.importc: "abort", header: "<stdlib.h>", noSideEffect, noreturn, ...raises: [], tags: [].}
- Source Edit
proc c_calloc(nmemb, size: csize_t): pointer {.importc: "calloc", header: "<stdlib.h>", ...raises: [], tags: [].}
- Source Edit
proc c_fprintf(f: CFilePtr; frmt: cstring): cint {.importc: "fprintf", header: "<stdio.h>", varargs, discardable, ...raises: [], tags: [].}
- Source Edit
proc c_fputs(c: cstring; f: CFilePtr): cint {.importc: "fputs", header: "<stdio.h>", discardable, ...raises: [], tags: [].}
- Source Edit
proc c_free(p: pointer) {.importc: "free", header: "<stdlib.h>", ...raises: [], tags: [].}
- Source Edit
proc c_fwrite(buf: pointer; size, n: csize_t; f: CFilePtr): cint {. importc: "fwrite", header: "<stdio.h>", ...raises: [], tags: [].}
- Source Edit
proc c_longjmp(jmpb: C_JmpBuf; retval: cint) {.header: "<setjmp.h>", importc: "longjmp", ...raises: [], tags: [].}
- Source Edit
proc c_malloc(size: csize_t): pointer {.importc: "malloc", header: "<stdlib.h>", ...raises: [], tags: [].}
- Source Edit
proc c_memchr(s: pointer; c: cint; n: csize_t): pointer {.importc: "memchr", header: "<string.h>", ...raises: [], tags: [].}
- Source Edit
proc c_memcmp(a, b: pointer; size: csize_t): cint {.importc: "memcmp", header: "<string.h>", noSideEffect, ...raises: [], tags: [].}
- Source Edit
proc c_memcpy(a, b: pointer; size: csize_t): pointer {.importc: "memcpy", header: "<string.h>", discardable, ...raises: [], tags: [].}
- Source Edit
proc c_memmove(a, b: pointer; size: csize_t): pointer {.importc: "memmove", header: "<string.h>", discardable, ...raises: [], tags: [].}
- Source Edit
proc c_memset(p: pointer; value: cint; size: csize_t): pointer {. importc: "memset", header: "<string.h>", discardable, ...raises: [], tags: [].}
- Source Edit
proc c_printf(frmt: cstring): cint {.importc: "printf", header: "<stdio.h>", varargs, discardable, ...raises: [], tags: [].}
- Source Edit
proc c_raise(sign: cint): cint {.importc: "raise", header: "<signal.h>", ...raises: [], tags: [].}
- Source Edit
proc c_realloc(p: pointer; newsize: csize_t): pointer {.importc: "realloc", header: "<stdlib.h>", ...raises: [], tags: [].}
- Source Edit
proc c_setjmp(jmpb: C_JmpBuf): cint {.header: "<setjmp.h>", importc: "setjmp", ...raises: [], tags: [].}
- Source Edit
proc c_signal(sign: cint; handler: CSighandlerT): CSighandlerT {. importc: "signal", header: "<signal.h>", discardable, ...raises: [], tags: [].}
- Source Edit
proc c_sprintf(buf, frmt: cstring): cint {.importc: "sprintf", header: "<stdio.h>", varargs, noSideEffect, ...raises: [], tags: [].}
- Source Edit
proc c_strcmp(a, b: cstring): cint {.importc: "strcmp", header: "<string.h>", noSideEffect, ...raises: [], tags: [].}
- Source Edit
proc c_strlen(a: cstring): csize_t {.importc: "strlen", header: "<string.h>", noSideEffect, ...raises: [], tags: [].}
- Source Edit