Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ODIN_CRT_MD flag for core:c/libc on windows #3307

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/c/libc/complex.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.3 Complex arithmetic

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/ctype.odin
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package libc

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/errno.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.5 Errors

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/math.odin
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ package libc
import "base:intrinsics"

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/setjmp.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.13 Nonlocal jumps

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/signal.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.14 Signal handling

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
13 changes: 10 additions & 3 deletions core/c/libc/stdio.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ package libc
import "core:io"

when ODIN_OS == .Windows {
foreign import libc {
"system:libucrt.lib",
"system:legacy_stdio_definitions.lib",
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc {
"system:ucrt.lib",
"system:legacy_stdio_definitions.lib",
}
} else {
foreign import libc {
"system:libucrt.lib",
"system:legacy_stdio_definitions.lib",
}
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/stdlib.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.22 General utilities

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/string.odin
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import "base:runtime"
// 7.24 String handling

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
13 changes: 10 additions & 3 deletions core/c/libc/threads.odin
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ thrd_start_t :: proc "c" (rawptr) -> int
tss_dtor_t :: proc "c" (rawptr)

when ODIN_OS == .Windows {
foreign import libc {
"system:libucrt.lib",
"system:msvcprt.lib",
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc {
"system:ucrt.lib",
"system:msvcprt.lib",
}
} else {
foreign import libc {
"system:libucrt.lib",
"system:msvcprt.lib",
}
}

thrd_success :: 0 // _Thrd_success
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/time.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.27 Date and time

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/uchar.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.28 Unicode utilities

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/wchar.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.29 Extended multibyte and wide character utilities

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down
6 changes: 5 additions & 1 deletion core/c/libc/wctype.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package libc
// 7.30 Wide character classification and mapping utilities

when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
when #config(WINDOWS_DYNAMIC_CRT, false) {
foreign import libc "system:ucrt.lib"
} else {
foreign import libc "system:libucrt.lib"
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
} else {
Expand Down