Author: damjan Date: Tue Mar 22 17:52:05 2016 New Revision: 1736221 URL: http://svn.apache.org/viewvc?rev=1736221&view=rev Log: As per https://support.microsoft.com/en-us/kb/140584 on Windows, MSVC's compiler (cl.exe) takes command-line parameters such as /MD[d] and /MT[d] to determine whether to link the C runtime library: * statically or dynamically * singly or multi threaded * debug or release
All that /MD[d] and /MT[d] do is define or undefine the _MT, _DLL and _DEBUG macros that do the real work, and the compiler then uses those macros to decide what to do when building the object file. Our build systems do not use the compiler command-line parameters, but define the macros directly. Of our 2 build systems, dmake always defines _MT and _DLL to get MSVCRT.DLL linked dynamically, but while gbuild defines _MT for all binary types, it only defines _DLL for dynamic libraries. This means executables trying to use the C++ standard library fail to link, as they get multiply defined symbols!!! This was first caught in basegfx GoogleTests which #include <iostream> and create classes from it. This patch changes Windows and OS/2 to define _DLL_ for dynamic libaries instead of _DLL as that has a special meaning, and define _DLL for all binary types on Windows so MSVCRT.DLL is always linked dynamically like it is with dmake. With this patch, Windows finally builds. Patch by: me Modified: openoffice/branches/gbuild-reintegration/main/basegfx/StaticLibrary_basegfx_s.mk openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/os2.mk openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/windows.mk openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/winmingw.mk Modified: openoffice/branches/gbuild-reintegration/main/basegfx/StaticLibrary_basegfx_s.mk URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/basegfx/StaticLibrary_basegfx_s.mk?rev=1736221&r1=1736220&r2=1736221&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/basegfx/StaticLibrary_basegfx_s.mk (original) +++ openoffice/branches/gbuild-reintegration/main/basegfx/StaticLibrary_basegfx_s.mk Tue Mar 22 17:52:05 2016 @@ -42,11 +42,9 @@ $(eval $(call gb_StaticLibrary_set_inclu # the whole library is a hack # we only build it to prevent the pdfimporter shared lib from linking to the basegfx shared lib # this means that all code of this static library will end in a dll -# thus the _DLL define must be set to avoid link problems with stlport symbols # the BASEGFX_STATICLIBRARY define will expand all BASEGFX_DLLPRIVATE/PUBLIC macros to nothing $(eval $(call gb_StaticLibrary_add_defs,basegfx_s,\ -DBASEGFX_STATICLIBRARY \ - -D_DLL \ )) # as we have to build all sources a second time, we must copy them to the workdir and build from there Modified: openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/os2.mk URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/os2.mk?rev=1736221&r1=1736220&r2=1736221&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/os2.mk (original) +++ openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/os2.mk Tue Mar 22 17:52:05 2016 @@ -353,7 +353,7 @@ endef # Library class -gb_Library_DEFS := -D_DLL +gb_Library_DEFS := -D_DLL_ gb_Library_TARGETTYPEFLAGS := -Zdll gb_Library_get_rpath := Modified: openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/windows.mk URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/windows.mk?rev=1736221&r1=1736220&r2=1736221&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/windows.mk (original) +++ openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/windows.mk Tue Mar 22 17:52:05 2016 @@ -57,6 +57,7 @@ gb_COMPILERDEFS := \ -D_CRT_NONSTDC_NO_DEPRECATE \ -D_CRT_SECURE_NO_DEPRECATE \ -D_MT \ + -D_DLL \ -DBOOST_MEM_FN_ENABLE_CDECL \ -DCPPU_ENV=msci \ -DFULL_DESK \ @@ -429,7 +430,7 @@ endef # Library class -gb_Library_DEFS := -D_DLL +gb_Library_DEFS := -D_DLL_ gb_Library_TARGETTYPEFLAGS := -DLL -OPT:NOREF -SAFESEH -NXCOMPAT -DYNAMICBASE gb_Library_get_rpath := Modified: openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/winmingw.mk URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/winmingw.mk?rev=1736221&r1=1736220&r2=1736221&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/winmingw.mk (original) +++ openoffice/branches/gbuild-reintegration/main/solenv/gbuild/platform/winmingw.mk Tue Mar 22 17:52:05 2016 @@ -446,7 +446,7 @@ endef # Library class -gb_Library_DEFS := -D_DLL +gb_Library_DEFS := -D_DLL_ gb_Library_TARGETTYPEFLAGS := -shared gb_Library_get_rpath :=