Skip to content

Commit a1328ca

Browse files
šŸ Fix dynamic loading of QDMI device DLLs on Windows when an absolute path is provided (backport #1720) (#1722)
## Description This fixes an oversight in #1694 that broke dynamic QDMI library loading on Windows and was discovered in iqm-finland/QDMI-on-IQM#63 If an absolute path is provided, the implementation now falls back to the previously-working one that used the simpler `LoadLibraryW` for loading the DLL. I'll to a test run of this PR in the QDMI-on-IQM repo before we merge and release. AI (Claude Code) was used to diagnose the issue and come up with potential solutions. The actual solution was implemented manually. ## Checklist - [x] The pull request only contains commits that are focused and relevant to this change. - [x] I have added appropriate tests that cover the new/changed functionality. - [x] I have updated the documentation to reflect these changes. - [x] I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals. - [x] I have added migration instructions to the upgrade guide (if needed). - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes. **If PR contains AI-assisted content:** - [x] I have disclosed the use of AI tools in the PR description as per our [AI Usage Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md). - [x] AI-assisted commits include an `Assisted-by: [Model Name] via [Tool Name]` footer. - [x] I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it. (cherry picked from commit 09bd043) Co-authored-by: Lukas Burgholzer <burgholzer@me.com>
1 parent 0debd13 commit a1328ca

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

ā€ŽCHANGELOG.mdā€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning], with the exception that minor rel
1313

1414
- 🚸 Improve native gate support for the Qiskit-to-OpenQASM3 conversion in the QDMI-Qiskit interface ([#1719]) ([**@burgholzer**])
1515

16+
### Fixed
17+
18+
- šŸ Fix dynamic loading of QDMI device DLLs on Windows when an absolute path is provided ([#1720]) ([**@burgholzer**])
19+
1620
## [3.6.0] - 2026-05-13
1721

1822
_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#360)._
@@ -370,8 +374,9 @@ _šŸ“š Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
370374
[3.0.0]: https://github.com/munich-quantum-toolkit/core/releases/tag/v3.0.0
371375
[2.7.0]: https://github.com/munich-quantum-toolkit/core/releases/tag/v2.7.0
372376

373-
<!-- PR links -->
377+
<!-- PR links -
374378
379+
[#1720]: https://github.com/munich-quantum-toolkit/core/pull/1720
375380
[#1719]: https://github.com/munich-quantum-toolkit/core/pull/1719
376381
[#1702]: https://github.com/munich-quantum-toolkit/core/pull/1702
377382
[#1694]: https://github.com/munich-quantum-toolkit/core/pull/1694

ā€Žsrc/qdmi/driver/Driver.cppā€Ž

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ namespace {
7474
[[nodiscard]] auto loadDeviceLibrary(const std::string& libName) -> HMODULE {
7575
const auto requested = std::filesystem::path(libName);
7676

77-
const std::filesystem::path path = requested.has_parent_path()
78-
? requested
79-
: getDriverDirectory() / requested;
77+
if (requested.has_parent_path()) {
78+
// A directory component was supplied: Directly load the library.
79+
return LoadLibraryW(requested.wstring().c_str());
80+
}
8081

82+
// Bare filename: resolve relative to the driver's own directory so that
83+
// builtin device DLLs installed next to the driver are found reliably.
84+
const auto path = getDriverDirectory() / requested;
8185
return LoadLibraryExW(path.wstring().c_str(), nullptr,
8286
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
8387
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);

0 commit comments

Comments
Ā (0)