aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-16 10:20:52 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-16 12:21:46 -0400
commitcbb6d2239f84ee13279655fc591530a23301d188 (patch)
treec89c4ecb59a0a91521ff32b81755ac56fb9336d7 /src/link.cpp
parent8cfb0cfbcee8161c52f71bccc3cf1b8d988f83b0 (diff)
downloadzig-cbb6d2239f84ee13279655fc591530a23301d188.tar.gz
zig-cbb6d2239f84ee13279655fc591530a23301d188.zip
look for libc at runtime on windows
See #539 before we close the issue we should also detect MSVC 2017 but this gets us started with supporting MSVC 2015
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/link.cpp b/src/link.cpp
index 0a25471d3c..f2f21fd746 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -397,6 +397,14 @@ static void construct_linker_job_coff(LinkJob *lj) {
lj->args.append(buf_ptr(buf_sprintf("-OUT:%s", buf_ptr(&lj->out_file))));
+ if (g->libc_link_lib != nullptr) {
+ lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", buf_ptr(g->msvc_lib_dir))));
+ 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 (lj->link_in_crt) {
const char *lib_str = g->is_static ? "lib" : "";
const char *d_str = (g->build_mode == BuildModeDebug) ? "d" : "";
@@ -441,11 +449,6 @@ static void construct_linker_job_coff(LinkJob *lj) {
lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", lib_dir)));
}
- if (g->libc_link_lib != nullptr) {
- 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))));
- }
-
for (size_t i = 0; i < g->link_objects.length; i += 1) {
lj->args.append((const char *)buf_ptr(g->link_objects.at(i)));
}