I have a static library(liba.a) and i want to use it in python
but import
can only import dynamic library in python
how to import static library in python??
You can't do this. You have two options: Recompile the library as a shared library. Then use ctypes to call methods from the dynamically-loaded shared library.
Static libraries are created using some type of archiving software, such as ar. ar takes one or more object files (that end in .o), zips them up, and generates an archive file (ends in . a) — This is our “static library”. Now that we have the object file(s), we can archive them and make a static library using ar.
You can't do this. You have two options:
Recompile the library as a shared library. Then use ctypes
to call methods from the dynamically-loaded shared library.
Build a Python Extension exposing a Python interface to the shared library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With