Add Options for Variation in C Runtime #5922
RealTrippR
started this conversation in
Proposals
Replies: 1 comment
-
|
One thing is that this is really windows specific. On unix you could benefit from something like this to switch between glibc, musl, cosmic libc, etc. But those actually have different struct layouts and definitions too. At that point it's almost something like a subtarget. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, Odin only gives 1 option to link against the C runtime:
-no-crtor crt. By default, Odin links against the static C runtime, which is suitable for the majority of use cases, but introduces complications when linking Odin code against code compiled for use with a dynamically linked C runtime.(See the example at the bottom)
The addition of a `-crt-mode` compiler flag could address this issue.
none- equivalent to -no-crtstatic- links to a statically linked CRT, debug-static if the-debugflag is set, otherwise to release-staticdynamic- links to a dynamically linked CRT, debug-dynamic if the-debugflag is set, otherwise to release-dynamicrelease-staticlinks to a statically linked release CRT, regardless of the-debugflag.release-dynamiclinks to a dynamically linked release CRT, regardless of the-debugflag.debug-staticlinks to a statically linked debug CRT, regardless of the-debugflag.debug-dynamiclinks to a dynamically linked debug CRT, regardless of the-debugflag.Example Test:
Running
make ctest.exeshould result in the linker error:error LNK2019: unresolved external symbol __imp_isspace referenced in function is_spacecaused by mismatch in expected CRT types.
Implementation
PROPOSAL-PROCESS.md doesn't specify anything about providing an existing implementation of a proposed feature, but if it helps I have a written a working implementation of
-crt-mode. It didn't require much change to the existing compiler (around 120 lines were modified).Beta Was this translation helpful? Give feedback.
All reactions