I have the following benchmark.cpp file: #include <boost/python.hpp> char const* greet() { return "hello, world"; } BOOST_PYTHON_MODULE(benchmark) { using namespace boost:ython; def("greet", greet); } which is built using CMakeLists.txt containing i.a. the following pieces of code: cmake_minimum_required(VERSION 3.21) find_package (Python3 COMPONENTS Interpreter Development REQUIRED) find_package(Boost COMPONENTS python REQUIRED) set(BENCHMARK_MODULE benchmark) add_library(${BENCHMARK_MODULE} MODULE benchmark.cpp) set_target_properties(${BENCHMARK_MODULE} PROPERTIES PREFIX "" SUFFIX ".pyd") target_include_directories(${BENCHMARK_MODULE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${BENCHMARK_MODULE} PUBLIC ${Boost_INCLUDE_DIR}) target_include_directories(${BENCHMARK_MODULE} SYSTEM PUBLIC ${Python3_INCLUDE_DIRS}) target_link_libraries(${BENCHMARK_MODULE} PUBLIC ${Python3_LIBRARIES}) target_link_libraries(${BENCHMARK_MODULE} PUBLIC ${Boost_LIBRARIES}) I'm building on Windows 10 using MSYS2's MinGW64 and Ninja generator; using Python 3.12. Dependencies - An open-source modern Dependency Walker gave me the following dependencies for benchmark.pyd: C:\WINDOWS\system32\kernel32.dll C:\msys64\mingw64\bin\libgcc_s_seh-1.dll C:\WINDOWS\system32\MSVCRT.dll C:\msys64\mingw64\bin\libstdc++-6.dll C:\msys64\mingw64\bin\libboost_python311-mt.dll C:\Program Files\Python312\python312.dll so in Python code, I've tried to import that module in the following way: import os import sys sys.path.append('C:\\msys64\\mingw64\\bin') [os.add_dll_directory(path) for path in sys.path if os.path.isdir(path)] import benchmark but when I run this code, I get "Process finished with exit code -1073741819 (0xC0000005)" message when importing benchmark module. What is the reason for such behavior? How to fix it? Continue reading...