aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/c/libc/complex.odin6
-rw-r--r--core/c/libc/ctype.odin6
-rw-r--r--core/c/libc/errno.odin6
-rw-r--r--core/c/libc/math.odin6
-rw-r--r--core/c/libc/setjmp.odin6
-rw-r--r--core/c/libc/signal.odin6
-rw-r--r--core/c/libc/stdio.odin6
-rw-r--r--core/c/libc/stdlib.odin8
-rw-r--r--core/c/libc/string.odin6
-rw-r--r--core/c/libc/threads.odin10
-rw-r--r--core/c/libc/time.odin6
-rw-r--r--core/c/libc/uchar.odin6
-rw-r--r--core/c/libc/wchar.odin6
-rw-r--r--core/c/libc/wctype.odin6
14 files changed, 73 insertions, 17 deletions
diff --git a/core/c/libc/complex.odin b/core/c/libc/complex.odin
index c11e51586..4e199ac69 100644
--- a/core/c/libc/complex.odin
+++ b/core/c/libc/complex.odin
@@ -2,7 +2,11 @@ package libc
// 7.3 Complex arithmetic
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
@(default_calling_convention="c")
foreign libc {
diff --git a/core/c/libc/ctype.odin b/core/c/libc/ctype.odin
index 2f9a023a6..0aefc00c3 100644
--- a/core/c/libc/ctype.odin
+++ b/core/c/libc/ctype.odin
@@ -1,6 +1,10 @@
package libc
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
// 7.4 Character handling
diff --git a/core/c/libc/errno.odin b/core/c/libc/errno.odin
index 78f6763eb..6d5a6ff0c 100644
--- a/core/c/libc/errno.odin
+++ b/core/c/libc/errno.odin
@@ -2,7 +2,11 @@ package libc
// 7.5 Errors
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
// C11 standard only requires the definition of:
// EDOM,
diff --git a/core/c/libc/math.odin b/core/c/libc/math.odin
index b3c285950..ae9e3c709 100644
--- a/core/c/libc/math.odin
+++ b/core/c/libc/math.odin
@@ -4,7 +4,11 @@ package libc
import "core:intrinsics"
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
// To support C's tgmath behavior we use Odin's explicit procedure overloading,
// but we cannot use the same names as exported by libc so use @(link_name)
diff --git a/core/c/libc/setjmp.odin b/core/c/libc/setjmp.odin
index 57a31301c..e1915c01d 100644
--- a/core/c/libc/setjmp.odin
+++ b/core/c/libc/setjmp.odin
@@ -2,7 +2,11 @@ package libc
// 7.13 Nonlocal jumps
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
@(default_calling_convention="c")
foreign libc {
diff --git a/core/c/libc/signal.odin b/core/c/libc/signal.odin
index 04a2d373f..22bcaec0b 100644
--- a/core/c/libc/signal.odin
+++ b/core/c/libc/signal.odin
@@ -2,7 +2,11 @@ package libc
// 7.14 Signal handling
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
sig_atomic_t :: distinct atomic_int;
diff --git a/core/c/libc/stdio.odin b/core/c/libc/stdio.odin
index 40e32ea07..0f7cb44a7 100644
--- a/core/c/libc/stdio.odin
+++ b/core/c/libc/stdio.odin
@@ -1,6 +1,10 @@
package libc
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
// 7.21 Input/output
diff --git a/core/c/libc/stdlib.odin b/core/c/libc/stdlib.odin
index ce9dc9c4e..ba4602e84 100644
--- a/core/c/libc/stdlib.odin
+++ b/core/c/libc/stdlib.odin
@@ -2,7 +2,11 @@ package libc
// 7.22 General utilities
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
when ODIN_OS == "windows" {
RAND_MAX :: 0x7fff;
@@ -14,7 +18,7 @@ when ODIN_OS == "windows" {
}
MB_CUR_MAX :: #force_inline proc() -> size_t {
- return ___mb_cur_max_func();
+ return size_t(___mb_cur_max_func());
}
}
diff --git a/core/c/libc/string.odin b/core/c/libc/string.odin
index 9665a8491..d39b4ecb2 100644
--- a/core/c/libc/string.odin
+++ b/core/c/libc/string.odin
@@ -3,7 +3,11 @@ package libc
// 7.24 String handling
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
foreign libc {
// 7.24.2 Copying functions
diff --git a/core/c/libc/threads.odin b/core/c/libc/threads.odin
index 93d4f4efe..cf21bc614 100644
--- a/core/c/libc/threads.odin
+++ b/core/c/libc/threads.odin
@@ -6,7 +6,10 @@ thrd_start_t :: proc "c" (rawptr) -> int;
tss_dtor_t :: proc "c" (rawptr);
when ODIN_OS == "windows" {
- foreign import libc "system:c"
+ foreign import libc {
+ "system:libucrt.lib",
+ "system:msvcprt.lib"
+ }
thrd_success :: 0; // _Thrd_success
thrd_nomem :: 1; // _Thrd_nomem
@@ -24,6 +27,7 @@ when ODIN_OS == "windows" {
thrd_t :: struct { _: rawptr, _: uint, } // _Thrd_t
tss_t :: distinct int; // _Tss_imp_t
cnd_t :: distinct rawptr; // _Cnd_imp_t
+ mtx_t :: distinct rawptr; // _Mtx_imp_t
// MSVCRT does not expose the C11 symbol names as what they are in C11
// because they held off implementing <threads.h> and C11 support for so
@@ -52,9 +56,9 @@ when ODIN_OS == "windows" {
@(link_name="_Mtx_unlock") mtx_unlock :: proc(mtx: ^mtx_t) -> int ---;
// 7.26.5 Thread functions
- @(link_name="_Thrd_create") thrd_create :: proc(thr: ^thr_t, func: thrd_start_t, arg: rawptr) -> int ---;
+ @(link_name="_Thrd_create") thrd_create :: proc(thr: ^thrd_t, func: thrd_start_t, arg: rawptr) -> int ---;
@(link_name="_Thrd_current") thrd_current :: proc() -> thrd_t ---;
- @(link_name="_Thrd_detach") thrd_detach :: proc(thr: thr_t) -> int ---;
+ @(link_name="_Thrd_detach") thrd_detach :: proc(thr: thrd_t) -> int ---;
@(link_name="_Thrd_equal") thrd_equal :: proc(lhs, rhs: thrd_t) -> int ---;
@(link_name="_Thrd_exit") thrd_exit :: proc(res: int) -> ! ---;
@(link_name="_Thrd_join") thrd_join :: proc(thr: thrd_t, res: ^int) -> int ---;
diff --git a/core/c/libc/time.odin b/core/c/libc/time.odin
index 42dd739e2..93574ae38 100644
--- a/core/c/libc/time.odin
+++ b/core/c/libc/time.odin
@@ -2,7 +2,11 @@ package libc
// 7.27 Date and time
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
// We enforce 64-bit time_t and timespec as there is no reason to use 32-bit as
// we approach the 2038 problem. Windows has defaulted to this since VC8 (2005).
diff --git a/core/c/libc/uchar.odin b/core/c/libc/uchar.odin
index 60b71d786..e9adbe13d 100644
--- a/core/c/libc/uchar.odin
+++ b/core/c/libc/uchar.odin
@@ -2,7 +2,11 @@ package libc
// 7.28 Unicode utilities
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
@(default_calling_convention="c")
foreign libc {
diff --git a/core/c/libc/wchar.odin b/core/c/libc/wchar.odin
index d66fa91b7..9851c8053 100644
--- a/core/c/libc/wchar.odin
+++ b/core/c/libc/wchar.odin
@@ -2,7 +2,11 @@ package libc
// 7.29 Extended multibyte and wide character utilities
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
@(default_calling_convention="c")
foreign libc {
diff --git a/core/c/libc/wctype.odin b/core/c/libc/wctype.odin
index fed258acd..8b887d309 100644
--- a/core/c/libc/wctype.odin
+++ b/core/c/libc/wctype.odin
@@ -2,7 +2,11 @@ package libc
// 7.30 Wide character classification and mapping utilities
-foreign import libc "system:c"
+when ODIN_OS == "windows" {
+ foreign import libc "system:libucrt.lib"
+} else {
+ foreign import libc "system:c"
+}
when ODIN_OS == "windows" {
wctrans_t :: distinct wchar_t;