[Mlir-commits] [mlir] [MLIR][Python][NOMERGE] demo building bindings with no CAPI aggregate and using mlir aggregate (PR #161782)

Maksim Levental llvmlistbot at llvm.org
Thu Oct 2 23:13:09 PDT 2025


================
@@ -0,0 +1,37 @@
+# RUN: echo "do nothing"
+# just so lit doesn't complain about a missing RUN line
+# noinspection PyUnusedImports
+import contextlib
+import ctypes
+import sys
+
+
+ at contextlib.contextmanager
+def dl_open_guard():
+    old_flags = sys.getdlopenflags()
+    sys.setdlopenflags(old_flags | ctypes.RTLD_GLOBAL)
----------------
makslevental wrote:

we need to use `RTLD_GLOBAL` so that `libMLIRPythonCAPI`'s symbols are made available for relocation processing of any other object (i.e., `_standReallyAloneDialectsNanobind`).

https://github.com/llvm/llvm-project/pull/161782


More information about the Mlir-commits mailing list