From: David Wells Date: Wed, 27 Apr 2022 19:34:41 +0000 (-0400) Subject: Fix linkage with bundled muParser + MSVC. X-Git-Tag: v9.4.0-rc1~237^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75724de3309ed88335024b43396c69e8a496c291;p=dealii.git Fix linkage with bundled muParser + MSVC. We should always set up the linkage options ourselves (i.e., always use static linkage) and not let muParser try to set things up for dynamic linkage in case we forget. This only applies to MSVC. --- diff --git a/bundled/muparser_v2_3_3/CMakeLists.txt b/bundled/muparser_v2_3_3/CMakeLists.txt index 2da17525c1..9c9c93780e 100644 --- a/bundled/muparser_v2_3_3/CMakeLists.txt +++ b/bundled/muparser_v2_3_3/CMakeLists.txt @@ -38,9 +38,3 @@ src/muParserInt.cpp src/muParserTest.cpp src/muParserTokenReader.cpp ) - -# We do not support (yet) compiling DLLs with MSVC. By default, muParser will -# try to set itself up correctly with __declspec(dllexport). Get around this by -# instructing it to use static linkage, which will define (see muParserFixes.h) -# AP_EXPORT_CXX to nothing. -DEAL_II_ADD_DEFINITIONS(obj_muparser "MUPARSER_STATIC") diff --git a/bundled/muparser_v2_3_3/include/muParserFixes.h b/bundled/muparser_v2_3_3/include/muParserFixes.h index 8042d281d3..32cd107761 100644 --- a/bundled/muparser_v2_3_3/include/muParserFixes.h +++ b/bundled/muparser_v2_3_3/include/muParserFixes.h @@ -61,29 +61,16 @@ MUPARSER_LOCAL is used for non-api symbols. */ -#ifndef MUPARSER_STATIC /* defined if muParser is compiled as a DLL */ - - #ifdef MUPARSERLIB_EXPORTS /* defined if we are building the muParser DLL (instead of using it) */ - #define API_EXPORT_CXX MUPARSER_HELPER_DLL_EXPORT - #else - #define API_EXPORT_CXX MUPARSER_HELPER_DLL_IMPORT - #endif /* MUPARSER_DLL_EXPORTS */ - #define MUPARSER_LOCAL MUPARSER_HELPER_DLL_LOCAL - -#else /* MUPARSER_STATIC is defined: this means muParser is a static lib. */ - - #define API_EXPORT_CXX - #define MUPARSER_LOCAL - -#endif /* !MUPARSER_STATIC */ - - -#ifdef _WIN32 - #define API_EXPORT(TYPE) API_EXPORT_CXX TYPE __cdecl -#else - #define API_EXPORT(TYPE) TYPE -#endif +// deal.II-specific patch: we +// 1) already set up our own flags for static linkage elsewhere +// 2) do not support dynamic linkage with MSVC +// to this end, override muParser's original logic here to unconditionally make +// API_EXPORT(TYPE) the identity function (and other relevant macros empty). +// Since this header is not installed this behavior change is purely internal. +#define API_EXPORT_CXX +#define MUPARSER_LOCAL +#define API_EXPORT(TYPE) TYPE #endif // include guard