mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Fix runtime crash for setjmp in Windows related to an hidden second argument not normally accessible needing to be set to 0.
This commit is contained in:
+21
-2
@@ -8,8 +8,23 @@ when ODIN_OS == "windows" {
|
|||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
}
|
}
|
||||||
|
|
||||||
@(default_calling_convention="c")
|
when ODIN_OS == "windows" {
|
||||||
foreign libc {
|
@(default_calling_convention="c")
|
||||||
|
foreign libc {
|
||||||
|
// 7.13.1 Save calling environment
|
||||||
|
//
|
||||||
|
// NOTE(dweiler): C11 requires setjmp be a macro, which means it won't
|
||||||
|
// necessarily export a symbol named setjmp but rather _setjmp in the case
|
||||||
|
// of musl, glibc, BSD libc, and msvcrt.
|
||||||
|
//
|
||||||
|
// TODO(mv): Some description of the extra argument, and maybe a link describing
|
||||||
|
// it in more detail?
|
||||||
|
@(link_name="_setjmp")
|
||||||
|
setjmp :: proc(env: ^jmp_buf, hack: rawptr = nil) -> int ---;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
@(default_calling_convention="c")
|
||||||
|
foreign libc {
|
||||||
// 7.13.1 Save calling environment
|
// 7.13.1 Save calling environment
|
||||||
//
|
//
|
||||||
// NOTE(dweiler): C11 requires setjmp be a macro, which means it won't
|
// NOTE(dweiler): C11 requires setjmp be a macro, which means it won't
|
||||||
@@ -17,7 +32,11 @@ foreign libc {
|
|||||||
// of musl, glibc, BSD libc, and msvcrt.
|
// of musl, glibc, BSD libc, and msvcrt.
|
||||||
@(link_name="_setjmp")
|
@(link_name="_setjmp")
|
||||||
setjmp :: proc(env: ^jmp_buf) -> int ---;
|
setjmp :: proc(env: ^jmp_buf) -> int ---;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@(default_calling_convention="c")
|
||||||
|
foreign libc {
|
||||||
// 7.13.2 Restore calling environment
|
// 7.13.2 Restore calling environment
|
||||||
longjmp :: proc(env: ^jmp_buf, val: int) -> ! ---;
|
longjmp :: proc(env: ^jmp_buf, val: int) -> ! ---;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user