diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-10-16 01:14:28 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-10-16 01:14:28 -0400 |
| commit | d08c57741ae190c587c42861e71b0e361903733e (patch) | |
| tree | ee79c77ec4a568d90ae1cfaefa6fd786cc788926 /src/link.cpp | |
| parent | 78b753af9dd9818b9dc848f590330c61b2ca7c3f (diff) | |
| download | zig-d08c57741ae190c587c42861e71b0e361903733e.tar.gz zig-d08c57741ae190c587c42861e71b0e361903733e.zip | |
ability to make a DLL
See #302
Diffstat (limited to 'src/link.cpp')
| -rw-r--r-- | src/link.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/link.cpp b/src/link.cpp index 475e42fd7b..0a25471d3c 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -372,6 +372,7 @@ static void construct_linker_job_coff(LinkJob *lj) { // how to handle --target-environ gnu // These comments are a clue + bool is_library = g->out_type == OutTypeLib; //bool dll = g->out_type == OutTypeLib; //bool shared = !g->is_static && dll; //if (g->is_static) { @@ -422,13 +423,19 @@ static void construct_linker_job_coff(LinkJob *lj) { //lj->args.append(get_libc_static_file(g, "crtbegin.o")); } else { lj->args.append("-NODEFAULTLIB"); - if (g->have_winmain) { - lj->args.append("-ENTRY:WinMain"); - } else { - lj->args.append("-ENTRY:WinMainCRTStartup"); + if (!is_library) { + if (g->have_winmain) { + lj->args.append("-ENTRY:WinMain"); + } else { + lj->args.append("-ENTRY:WinMainCRTStartup"); + } } } + if (is_library && !g->is_static) { + lj->args.append("-DLL"); + } + for (size_t i = 0; i < g->lib_dirs.length; i += 1) { const char *lib_dir = g->lib_dirs.at(i); lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", lib_dir))); |
