Python Forum
Can Embedded Python run any shared library on Android ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Can Embedded Python run any shared library on Android ? (/thread-30822.html)



Can Embedded Python run any shared library on Android ? - sprotz - Nov-08-2020

As I have experienced, porting Python to Android is savagely difficult. However, there is a ready made Python interpreter on Android, along with its standard libraries, but porting a third party library as a Python module to Android is a nightmare. That's why I prefer the easier way as I've done on Windows, loading a precompiled library and using it like so:
from ctypes import *
lib = cdll.LoadLibrary("lib.so")
So my question is, can a Python interpreter running on Android load any shared library using this method and access its functions? Does the library have to be compiled with the 'extern C' method to be accessible? Does the library have had to be compiled with a JNI interface or is it not needed?
In summary, can Python embedded in Android use a shared library that is not compiled as a module ?