Pre-built QuantLib as a Windows x64 DLL.
Upstream QuantLib blocks DLL builds on MSVC. This project patches the source to enable shared library builds and publishes pre-built binaries as GitHub Release assets.
Go to Releases and download the zip for your QuantLib version.
Extract to a directory of your choice (e.g. C:\quantlib-deps):
Expand-Archive QuantLib-1.41-x64-dll.zip -DestinationPath C:\quantlib-depsThis gives you:
C:\quantlib-deps\
QuantLib-1.41\
bin\QuantLib-x64-mt.dll # Runtime DLL
lib\QuantLib-x64-mt.lib # Import library for linking
include\ql\... # QuantLib headers (patched for DLL)
boost_1_87_0\
boost\... # Boost headers
Requirements: Visual Studio 2022 (C++ workload), CMake, 7-Zip.
.\scripts\Build-QuantLibDLL.ps1 -PackageZipBy default the working directory is build/ and the install directory is install/ inside the repo, so you can inspect the patched QuantLib sources at build\QuantLib-<version>\ after the build.
With custom versions and install location:
.\scripts\Build-QuantLibDLL.ps1 `
-QuantLibVersion 1.41 `
-BoostVersion 1.87.0 `
-InstallDir C:\Users\me\quantlib-deps\QuantLib-1.41 `
-PackageZipInclude the QuantLib test suite:
.\scripts\Build-QuantLibDLL.ps1 -BuildTests -PackageZipFive patches are applied to the QuantLib source to enable DLL builds:
| File | Patch |
|---|---|
cmake/Platform.cmake |
Remove FATAL_ERROR that blocks DLL builds on MSVC |
ql/CMakeLists.txt |
Add RUNTIME DESTINATION so cmake --install copies the DLL |
ql/qldefines.hpp.cfg |
Inject QL_EXPORT / QL_IMPORT_ONLY macros for dllexport/dllimport |
ql/math/distributions/normaldistribution.hpp |
Add QL_EXPORT to InverseCumulativeNormal and MoroInverseCumulativeNormal |
ql/cashflows/lineartsrpricer.hpp |
Add QL_EXPORT to defaultLowerBound and defaultUpperBound static const members |
The last three patches are needed because CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does not export private static const class data members. Without these patches, consumers get unresolved symbol errors at link time.
- Visual Studio 2022 (MSVC)
- CMake with
BUILD_SHARED_LIBS=ONandCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON - MSVC DLL CRT runtime (
/MD) - Boost headers only (no compiled Boost libraries needed)
This repository (build scripts and CI configuration) is licensed under the BSD 3-Clause License. QuantLib itself is licensed under the QuantLib License (BSD-modified).