Browse Source

Merge pull request #2134 from jrfondren/errno-linkfix

fix core:c/libc.errno link_name for Linux and FreeBSD
gingerBill 2 years ago
parent
commit
d5047e621d
1 changed files with 15 additions and 2 deletions
  1. 15 2
      core/c/libc/errno.odin

+ 15 - 2
core/c/libc/errno.odin

@@ -14,11 +14,24 @@ when ODIN_OS == .Windows {
 //	EDOM,
 //	EDOM,
 //	EILSEQ
 //	EILSEQ
 //	ERANGE
 //	ERANGE
-when ODIN_OS == .Linux || ODIN_OS == .FreeBSD {
+when ODIN_OS == .Linux {
 	@(private="file")
 	@(private="file")
 	@(default_calling_convention="c")
 	@(default_calling_convention="c")
 	foreign libc {
 	foreign libc {
-		@(link_name="__libc_errno_location")
+		@(link_name="__errno_location")
+		_get_errno :: proc() -> ^int ---
+	}
+
+	EDOM   :: 33
+	EILSEQ :: 84
+	ERANGE :: 34
+}
+
+when ODIN_OS == .FreeBSD {
+	@(private="file")
+	@(default_calling_convention="c")
+	foreign libc {
+		@(link_name="__error")
 		_get_errno :: proc() -> ^int ---
 		_get_errno :: proc() -> ^int ---
 	}
 	}