From e8671fa9030eece5ce3e5a1dd85e2e863cada36f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Feb 2026 07:21:56 +0000 Subject: [PATCH] Suppress C4251 warnings in DLL build Inject `add_compile_options(/wd4251)` into cmake/Platform.cmake during patching. C4251 fires for every class member using STL types in a DLL-exported class; with CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON these warnings are harmless noise that drowns out real diagnostics. https://claude.ai/code/session_012RnYmE4NKFQ4NjtbkQANzF --- scripts/Build-QuantLibDLL.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Build-QuantLibDLL.ps1 b/scripts/Build-QuantLibDLL.ps1 index bbd8390..43d4030 100644 --- a/scripts/Build-QuantLibDLL.ps1 +++ b/scripts/Build-QuantLibDLL.ps1 @@ -10,6 +10,7 @@ Upstream QuantLib blocks DLL builds on MSVC with a FATAL_ERROR. This script applies five patches to enable DLL builds: 1. cmake/Platform.cmake - Remove FATAL_ERROR blocking DLL builds + and suppress C4251 warnings 2. ql/CMakeLists.txt - Add RUNTIME DESTINATION for DLL install 3. ql/qldefines.hpp.cfg - Inject QL_EXPORT/QL_IMPORT_ONLY macros 4. normaldistribution.hpp - Annotate classes with QL_EXPORT @@ -113,7 +114,7 @@ $PlatformCmake = "$QLSrcDir\cmake\Platform.cmake" $original = Get-Content $PlatformCmake -Raw $patched = $original -replace ` 'message\(FATAL_ERROR\s*\r?\n\s*"Shared library \(DLL\) builds for QuantLib on MSVC are not supported"\)', ` - '# Patched: DLL build enabled (FATAL_ERROR removed by QuantLib-DLL)' + "# Patched: DLL build enabled (FATAL_ERROR removed by QuantLib-DLL)`nadd_compile_options(/wd4251) # Suppress C4251: STL types in DLL-exported class members" if ($patched -eq $original) { Write-Warning "Platform.cmake patch pattern did not match - file may have changed or already patched" Select-String -Path $PlatformCmake -Pattern "FATAL_ERROR|BUILD_SHARED|EXPORT_ALL|Patched" | Write-Host