Skip to content

Pre-built QuantLib DLL for Windows (x64, MSVC)

License

Unknown, BSL-1.0 licenses found

Licenses found

Unknown
LICENSE
BSL-1.0
LICENSE_BOOST.txt
Notifications You must be signed in to change notification settings

lifelib-dev/QuantLib-DLL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuantLib-DLL

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.

Download

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-deps

This 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

Build locally

Requirements: Visual Studio 2022 (C++ workload), CMake, 7-Zip.

.\scripts\Build-QuantLibDLL.ps1 -PackageZip

By 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 `
    -PackageZip

Include the QuantLib test suite:

.\scripts\Build-QuantLibDLL.ps1 -BuildTests -PackageZip

Build and run the test suite:

.\scripts\Build-QuantLibDLL.ps1 -RunTests -PackageZip

Patches applied

Eight 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 and suppress C4251 warnings
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
ql/experimental/math/gaussiancopulapolicy.hpp Add QL_EXPORT to density_ and cumulative_ static const members
ql/math/randomnumbers/primitivepolynomials.hpp Add QL_EXPORT to PrimitivePolynomials extern array
Singleton DLL fix Create ql/patterns/singleton.cpp with explicit template instantiations and add extern template declarations to each singleton header so only one copy of each singleton exists across DLL/EXE boundaries

Patches 3–7 are needed because CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does not export private static const class data members or extern "C" arrays. Without these patches, consumers get unresolved symbol errors at link time.

The singleton fix (patch 8) solves a separate problem: without it, both the DLL and any consuming EXE independently instantiate Singleton<T>::instance(), producing two separate singleton objects. This causes widespread test failures because, for example, Settings::instance().evaluationDate() set in the EXE has no effect on the DLL's own copy.

Build details

  • Visual Studio 2022 (MSVC)
  • CMake with BUILD_SHARED_LIBS=ON and CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
  • MSVC DLL CRT runtime (/MD)
  • Boost headers only (no compiled Boost libraries needed)

License

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).

About

Pre-built QuantLib DLL for Windows (x64, MSVC)

Resources

License

Unknown, BSL-1.0 licenses found

Licenses found

Unknown
LICENSE
BSL-1.0
LICENSE_BOOST.txt

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •