Using a static library in a C extension for Python

lgabiot lgabiot at hotmail.com
Wed Jan 22 06:01:50 EST 2014


Hello,

working on OS X 10.8.5
Python 2.7

I've written a simple C extension for Python that uses the cairo graphic 
library.
It works well, and I can call it from Python with no problem.
The only drawback is that I need to have the cairo library installed on 
my system (so it seems my extension calls dynamically the cairo library).
I believe this because it doesn't work on a system where cairo is not 
installed.

Is it possible to link statically cairo to my extension, so that even if 
cairo is not installed on a computer, the code will run?

I guess I would need to modify the setup.py file using distutils to 
compile cairo statically into my .so file?

Or am I completely wrong?

If someone has a hint...

thanks!




More information about the Python-list mailing list