Kivy-ios : Some questions on dynamic loading of native extensions

26 views
Skip to first unread message

Pascal Chambon

unread,
Jun 6, 2022, 4:54:39 AM6/6/22
to Kivy users support
Hello,

I've explored a bit the code of kivy-ios to better grasp the implications of the "single binary" concept, and if I understand correctly :

- all compiled python extensions must be turned into static libraries ("mylib.a"), while the .so files are left empty, just as markers
- the dlopen() call used when importing modules is replaced by a dlsym() against the current code object, in https://github.com/kivy/kivy-ios/blob/ab219f06099c9ae4a4ccd853dbe49d19309953a7/kivy_ios/recipes/python3/dynload_shlib.patch

So here are some questions, thanks in advance to anyone who could enlighten me about these  ^^

- what is the purpose of the custom importer, doesn't Python already perform this search of .so/.dll/etc extension files usually ?

- what prevents collisions between the native symbols in the "single binary", since everything is merged? Maybe nothing special, and it's just up to APIs to use qualified names themselves?

- some libs like Pycryptodome use CFFI or CTYPES to dynamically find and load their native extensions, what would be the amount of operations to make these play well with Kivy-ios too? I guess one would have to create recipes so that all their ".so" are properly created as ".a" files, and then patch all relevant libs (ctypes, cffi...) to once more redirect the loading of symbols to the current binary?

- have there already been discusions about packages containing Rust extensions, like cryptography?

regards,
Pascal













Robert

unread,
Jun 6, 2022, 12:30:17 PM6/6/22
to Kivy users support
I suggest you ask here https://discord.gg/8mz2qnJd
The person you want to talk to is @misl6

And yes, I played with kivy-ios a while back and ran into similar questions.
Reply all
Reply to author
Forward
0 new messages