diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-10-14 20:12:15 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-10-14 20:12:15 -0400 |
| commit | fd7654e4e80f59e18bfaf7ba4872fefcd74feeb5 (patch) | |
| tree | a7f7582bc03d4f0a562dfef581613412641474a3 /src | |
| parent | f54aff46721b04fe43b645f27d3c4dbb8d2cc74d (diff) | |
| download | zig-fd7654e4e80f59e18bfaf7ba4872fefcd74feeb5.tar.gz zig-fd7654e4e80f59e18bfaf7ba4872fefcd74feeb5.zip | |
build-exe allows direct export of WinMainCRTStartup
Diffstat (limited to 'src')
| -rw-r--r-- | src/all_types.hpp | 1 | ||||
| -rw-r--r-- | src/analyze.cpp | 4 | ||||
| -rw-r--r-- | src/codegen.cpp | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp index bbb4f43497..57ff028d40 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -1455,6 +1455,7 @@ struct CodeGen { bool have_pub_main; bool have_c_main; bool have_winmain; + bool have_winmain_crt_startup; bool have_pub_panic; Buf *libc_lib_dir; Buf *libc_static_lib_dir; diff --git a/src/analyze.cpp b/src/analyze.cpp index 1a39140e66..5e702964d3 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -3196,6 +3196,10 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a g->have_winmain = true; g->windows_subsystem_windows = true; g->windows_subsystem_console = false; + } else if (proto_node->data.fn_proto.visib_mod == VisibModExport && + buf_eql_str(proto_name, "WinMainCRTStartup") && g->zig_target.os == ZigLLVM_Win32) + { + g->have_winmain_crt_startup = true; } } diff --git a/src/codegen.cpp b/src/codegen.cpp index 03fa976b2e..985e390758 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5213,7 +5213,8 @@ static void gen_root_source(CodeGen *g) { assert(g->root_out_name); assert(g->out_type != OutTypeUnknown); - if (!g->is_test_build && g->zig_target.os != ZigLLVM_UnknownOS && !g->have_c_main && !g->have_winmain && + if (!g->is_test_build && g->zig_target.os != ZigLLVM_UnknownOS && + !g->have_c_main && !g->have_winmain && !g->have_winmain_crt_startup && ((g->have_pub_main && g->out_type == OutTypeObj) || g->out_type == OutTypeExe)) { g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g, g->root_package), "bootstrap.zig"); |
