[python] Report the dlopen failure reason from load_library - #63
[python] Report the dlopen failure reason from load_library#63conrade-ctc wants to merge 2 commits into
Conversation
Cpp::LoadLibrary drops the loader message, so load_library asks the loader again with dlopen and reports its dlerror text. Co-developed-with-the-help-of: Claude Code (Opus 5, human in the loop)
There was a problem hiding this comment.
This is a nice improvement! Perhaps we could have Cpp::LoadLibrary give us the diagnostics on why it failed so we can avoid re-attempting dlopen with ctypes on the Python side.
edit: Just saw compiler-research/CppInterOp#1101, I think that would be the best solution here
|
Agreed, #1101 is the right place for this, and I think a |
We can add an optional out param to LoadLibrary and once that lands, use that in this PR (you can bump the pinned commit here so it builds with latest CppInterOp containing #1101) |
Cpp::LoadLibrary now hands back the loader's reason through an optional out-parameter (compiler-research/CppInterOp#1107), so the ctypes re-dlopen probe goes away. The pin bump to a CppInterOp commit that carries #1107 is folded in when it lands. Co-developed-with-the-help-of: Claude Code (Fable 5.1, human in the loop)
|
Opened compiler-research/CppInterOp#1107 with the optional |
Cpp::LoadLibrary drops the loader's failure reason, so load_library raises a bare error. This change asks the loader again with dlopen and reports its dlerror text, when the captured stderr is empty. A companion CppInterOp PR (compiler-research/CppInterOp#1101) emits the same reason on stderr directly; this change stands on its own if that PR lags. It adds a regression test for a missing library and a truncated ELF header.