Using a static library in a C extension for Python

88888 Dihedral dihedral88888 at gmail.com
Wed Jan 22 12:31:04 EST 2014


On Wednesday, January 22, 2014 7:01:50 PM UTC+8, lgabiot wrote:
> 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!

Check the  C source code generated 
by Pyrex and check cython for what u 
want, but I did try that out in any 
mobile phone or flat panel
programming.



More information about the Python-list mailing list