Skip to content

Commit

Permalink
build-exe allows direct export of WinMainCRTStartup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Oct 15, 2017
1 parent f54aff4 commit fd7654e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/all_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/analyze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
Expand Down
3 changes: 2 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit fd7654e

Please sign in to comment.