aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp15
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)));