From fb5618e336a58d478e3e9b9a03b51d80057fb4fa Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 14 Feb 2012 19:12:37 +0400 Subject: [PATCH] =?UTF-8?q?Fixed=20#65=20=E2=80=94=20Renaming=20shared=20l?= =?UTF-8?q?ib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/linker.cpp | 28 +++++++++++++++------------- gen/main.cpp | 9 ++++++--- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gen/linker.cpp b/gen/linker.cpp index a1d94259..ce880239 100644 --- a/gen/linker.cpp +++ b/gen/linker.cpp @@ -262,21 +262,23 @@ int linkObjToBinary(bool sharedLib) output = FileName::removeExt((char*)global.params.objfiles->data[0]); else output = "a.out"; + + if (sharedLib) { + std::string libExt = std::string(".") + global.dll_ext; + if (!endsWith(output, libExt)) + { + if (global.params.os != OSWindows) + output = "lib" + output + libExt; + else + output.append(libExt); + } + args.push_back("-shared"); + } else if (global.params.os == OSWindows && !endsWith(output, ".exe")) { + output.append(".exe"); + } } - if (sharedLib) { - std::string libExt = std::string(".") + global.dll_ext; - if (!endsWith(output, libExt)) - { - if (global.params.os != OSWindows) - output = "lib" + output + libExt; - else - output.append(libExt); - } - args.push_back("-shared"); - } else if (global.params.os == OSWindows && !endsWith(output, ".exe")) { - output.append(".exe"); - } + args.push_back("-o"); args.push_back(output.c_str()); diff --git a/gen/main.cpp b/gen/main.cpp index f2fcbee5..056187e8 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -407,9 +407,12 @@ int main(int argc, char** argv) error("flags conflict with -run"); fatal(); } - else - { - if (global.params.objname && files.dim > 1 && !singleObj) + else if (global.params.objname && files.dim > 1) { + if (createStaticLib || createSharedLib) + { + singleObj = true; + } + if (!singleObj) { error("multiple source files, but only one .obj name"); fatal();