Commit 8f962a957a

Andrew Kelley <superjoe30@gmail.com>
2018-03-31 17:26:02
fix regressions on windows
1 parent c3724ec
Changed files (2)
src/analyze.cpp
@@ -4378,6 +4378,7 @@ void find_libc_include_path(CodeGen *g) {
 
         if (g->zig_target.os == OsWindows) {
             ZigWindowsSDK *sdk = get_windows_sdk(g);
+            g->libc_include_dir = buf_alloc();
             if (os_get_win32_ucrt_include_path(sdk, g->libc_include_dir)) {
                 zig_panic("Unable to determine libc include path.");
             }
src/link.cpp
@@ -455,7 +455,9 @@ static void construct_linker_job_coff(LinkJob *lj) {
         lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->kernel32_lib_dir))));
 
         lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_lib_dir))));
-        lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_static_lib_dir))));
+        if (g->libc_static_lib_dir != nullptr) {
+            lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->libc_static_lib_dir))));
+        }
     }
 
     if (lj->link_in_crt) {