<div dir="ltr"><div>On 10 May 2016 at 18:52, Matthew Brett <span dir="ltr"><<a href="mailto:matthew.brett@gmail.com" target="_blank">matthew.brett@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Tue, May 10, 2016 at 5:26 PM, Matthew Brett <<a href="mailto:matthew.brett@gmail.com">matthew.brett@gmail.com</a>> wrote:<br>
>> [...]<br>
>><br>
>> This would probably look like:<br>
>><br>
>> _tkagg.so has a DT_NEEDED entry naming tkinter.so (or whatever Python calls<br>
>> this module)<br>
>><br>
>> Before loading _tkagg.so, we use Python level introspection figure out where<br>
>> tkinter.so lives<br>
>><br>
>> We add its directory to LD_LIBRARY_PATH<br>
>><br>
>> we import _tkagg.so<br>
>><br>
>> We take its directory back off of LD_LIBRARY_PATH<br>
>><br>
>> Very weird, but I can't see why it wouldn't work, and probably more reliable<br>
>> than anything where we try to reimplement the dynamic loader's search logic<br>
>> ourselves.<br>
><br>
> Nice - yes - it does work in a first-pass test - I'll look into automating that.<br>
<br>
</div></div>Ah - except I do not believe it is possible to change the linker path<br>
for Python modules, within the Python process:<br>
<br>
<a href="http://www.gossamer-threads.com/lists/python/python/393770#393770" rel="noreferrer" target="_blank">http://www.gossamer-threads.com/lists/python/python/393770#393770</a></blockquote><div><br></div>I was about to point that out...<div><br></div><div>On the other hand, if there is a `Tkinter` module that Python can import, just importing it will make the symbols needed the `_tkagg` module available, assuming Python calls `dlopen()` on import with RTLD_GLOBAL[1].</div><div><br></div><div>[1] <a href="http://man7.org/linux/man-pages/man3/dlopen.3.html">http://man7.org/linux/man-pages/man3/dlopen.3.html</a></div><div> </div></div></div></div>