zig/src
Dimenus 38f05d4ac5 WIN32: Linking with the CRT at runtime. (#570)
Disclaimer: Forgive me if my format sucks, I've never submitted a PR before!

Fixes: #517 

I added a few things to allow zig to link with the CRT properly both statically and dynamically. In Visual Studio 2017, Microsoft changed how the c-runtime is factored again. With this change, they also added a COM interface to allow you to query the respective Visual Studio instance for two of them. This does that and also falls back on a registry query for 2015 support. If you're using a Visual Studio instance older than 2015, you'll have to use the existing options available with the zig compiler. Changes are listed below along with a general description of the changes.

all_types.cpp:

The separate variables for msvc/kern32 have been removed and all win32 libc directory paths have been combined into a ZigList since we're querying more than two directories and differentiating one from another doesn't matter to lld.

analyze.cpp:

The existing functions were extended to support querying libc libs & libc headers at runtime.

codegen.cpp/hpp:

Microsoft uses the new 'Universal C Runtime' name now. Doesn't matter from a functionality standpoint. I left the compiler switches as is to not introduce any breaking changes.

link.cpp:

We're linking 4 libs and generating another in order to support the UCRT.
Dynamic: msvcrt/d, vcruntime/d, ucrt/d, legacy_stdio_definitions.lib
Static: libcmt/d, libvcruntime/d libucrt/d, legacy_stdio_definitions.lib

main.cpp:

Update function call names.

os.cpp/hpp:

COM/Registry interface for querying Windows UCRT/SDK.

Sources:
[Windows CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features)
[VS 2015 Breaking Changes](https://msdn.microsoft.com/en-us/library/bb531344.aspx)
2017-11-01 15:33:14 -04:00
..
all_types.hpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
analyze.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
analyze.hpp remove zigrt 2017-09-30 20:21:57 -04:00
ast_render.cpp parse-c: field access expressions 2017-09-21 00:54:08 -04:00
ast_render.hpp rewrite parseh to use AST instead of direct types 2017-09-02 04:11:23 -04:00
bigfloat.cpp depend on embedded SoftFloat-3d instead of __float128 2017-09-14 01:46:47 -04:00
bigfloat.hpp depend on embedded SoftFloat-3d instead of __float128 2017-09-14 01:46:47 -04:00
bigint.cpp do not depend on __int128 2017-09-14 02:48:16 -04:00
bigint.hpp do not depend on __int128 2017-09-14 02:48:16 -04:00
buffer.cpp add missing copyright notices 2016-12-04 21:06:13 -05:00
buffer.hpp fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
c_tokenizer.cpp c macros: support hex chars (#459) 2017-09-10 16:35:56 -04:00
c_tokenizer.hpp c macros: support hex chars (#459) 2017-09-10 16:35:56 -04:00
codegen.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
codegen.hpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
config.h.in remove CXX ABI workaround 2017-10-23 22:37:59 -04:00
errmsg.cpp better output when @cImport generates invalid zig 2017-10-26 00:32:30 -04:00
errmsg.hpp use size_t for indexes 2016-09-19 11:54:01 -04:00
error.cpp more intuitive left shift and right shift operators 2017-08-09 10:09:38 -04:00
error.hpp more intuitive left shift and right shift operators 2017-08-09 10:09:38 -04:00
hash_map.hpp rewrite scope implementation 2016-12-01 21:08:12 -05:00
ir_print.cpp add @setAlignStack builtin 2017-10-03 00:29:27 -04:00
ir_print.hpp make undefined as a constant value lazy 2017-04-23 14:34:40 -04:00
ir.cpp cleaner verbose flags and zig build prints failed command 2017-10-25 23:10:41 -04:00
ir.hpp rewrite parseh to use AST instead of direct types 2017-09-02 04:11:23 -04:00
link.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
link.hpp ability to cross compile 2016-02-11 01:33:27 -07:00
list.hpp fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
main.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
os.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
os.hpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
parsec.cpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
parsec.hpp rename parseh to parsec 2017-09-05 22:55:03 -04:00
parser.cpp fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
parser.hpp fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
range_set.cpp better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
range_set.hpp better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
softfloat.hpp depend on embedded SoftFloat-3d instead of __float128 2017-09-14 01:46:47 -04:00
target.cpp fix typo in target_can_exec logic 2017-09-30 20:10:09 -04:00
target.hpp zig test on 64-bit windows runs 32-bit tests 2017-09-30 14:40:16 -04:00
tokenizer.cpp Improve invalid character error messages (#566) 2017-10-26 10:00:23 -04:00
tokenizer.hpp introduce align keyword 2017-08-29 07:51:34 -04:00
util.cpp support linking against MSVC libc 2017-10-01 21:05:08 -04:00
util.hpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
windows_com.hpp WIN32: Linking with the CRT at runtime. (#570) 2017-11-01 15:33:14 -04:00
zig_llvm.cpp remove CXX ABI workaround 2017-10-23 22:37:59 -04:00
zig_llvm.hpp add module flag to emit CodeView for COFF object files 2017-10-10 18:04:02 -04:00