[python][win] use .dll for shared lib test, catch error for win32 workaround - #126
Merged
Merged
Conversation
guitargeek
requested changes
Oct 1, 2026
guitargeek
left a comment
Collaborator
There was a problem hiding this comment.
Since you're already fixing for different shared object extensions, this should be done consistently in the other places that hardcode .so as well.
So I'd suggest complementing the PR with this patch:
diff --git a/test/Makefile b/test/Makefile
index 7f1433e..7c89130 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,6 +1,11 @@
# the C++ sides of the tests live under cpp/ and build into shared
# libraries next to their sources (load_reflection_info resolves the
-# header as a sibling of the loaded Dict.so)
+# header as a sibling of the loaded Dict library)
+soext = .so
+ifeq ($(OS),Windows_NT)
+ soext = .dll
+endif
+
dictnames = advancedcpp \
advancedcpp2 \
conversions \
@@ -17,7 +22,7 @@ dictnames = advancedcpp \
stltypes \
templates
-dicts = $(addprefix cpp/,$(addsuffix Dict.so,$(dictnames)))
+dicts = $(addprefix cpp/,$(addsuffix Dict$(soext),$(dictnames)))
all : $(dicts)
@@ -30,11 +35,11 @@ ifeq ($(PLATFORM),Darwin)
endif
# a worker can load the library while another rebuilds it, so publish it whole
-cpp/%Dict.so: cpp/%.cxx cpp/%.h
+cpp/%Dict$(soext): cpp/%.cxx cpp/%.h
$(CXX) $(cppflags) -shared -o $@.$$$$.tmp $< && mv -f $@.$$$$.tmp $@
diff --git a/test/Makefile b/test/Makefile
index 7f1433e..7c89130 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,6 +1,11 @@
# the C++ sides of the tests live under cpp/ and build into shared
# libraries next to their sources (load_reflection_info resolves the
-# header as a sibling of the loaded Dict.so)
+# header as a sibling of the loaded Dict library)
+soext = .so
+ifeq ($(OS),Windows_NT)
+ soext = .dll
+endif
+
dictnames = advancedcpp \
advancedcpp2 \
conversions \
@@ -17,7 +22,7 @@ dictnames = advancedcpp \
stltypes \
templates
-dicts = $(addprefix cpp/,$(addsuffix Dict.so,$(dictnames)))
+dicts = $(addprefix cpp/,$(addsuffix Dict$(soext),$(dictnames)))
all : $(dicts)
@@ -30,11 +35,11 @@ ifeq ($(PLATFORM),Darwin)
endif
# a worker can load the library while another rebuilds it, so publish it whole
-cpp/%Dict.so: cpp/%.cxx cpp/%.h
+cpp/%Dict$(soext): cpp/%.cxx cpp/%.h
$(CXX) $(cppflags) -shared -o $@.$$$$.tmp $< && mv -f $@.$$$$.tmp $@
-# convenience: `make datatypesDict.so` builds cpp/datatypesDict.so
-%Dict.so: cpp/%Dict.so ;
+# convenience: `make datatypesDict$(soext)` builds cpp/datatypesDict$(soext)
+%Dict$(soext): cpp/%Dict$(soext) ;
.PHONY: test clean
diff --git a/test/support.py b/test/support.py
index 91fab8e..94c4738 100644
--- a/test/support.py
+++ b/test/support.py
@@ -45,7 +45,7 @@ def setup_make(targetname, optional=False):
if fcntl is not None:
fcntl.flock(lockf, fcntl.LOCK_EX)
popen = subprocess.Popen(
- ["make", targetname + "Dict.so"],
+ ["make", targetname + "Dict" + soext],
cwd=str(currpath),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
mcbarton
reviewed
Oct 1, 2026
test03_add_library_path hardcodes .so for the library it copies and loads, so on Windows the load can never succeed (the dictionary is a .dll there), and the test Makefile and setup_make build and name the dictionaries as Dict.so as well. Derive the extension from the platform once, in support.py next to the other platform facts and as soext in the Makefile, and use it everywhere the dictionaries are built or loaded. Once the load succeeds, the library is mapped into the process and Windows refuses to delete it, so the temporary directory is cleaned up with ignore_cleanup_errors. Seen on the Windows CI of ROOT's cppjit migration branch, which is currently the only Windows coverage the test suite gets.
The Windows workaround declares an explicit specialization of std::endl<char> at import time. When std::endl<char> was already instantiated in the interpreter, as it is when cppjit is imported into a process that loaded iostream-using headers before it (ROOT's PyROOT), the declaration is ill-formed and cppdef raises SyntaxError, which aborts the import. Ignore that error: the instantiation the workaround wants already exists.
aaronj0
force-pushed
the
windows-portability
branch
from
October 1, 2026 09:41
4250d87 to
67116c8
Compare
guitargeek
approved these changes
Oct 1, 2026
guitargeek
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Thanks for these Windows fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.