C extensions without using shared libraries

Ignacio Vazquez-Abrams ignacio at openservices.net
Wed Sep 5 01:35:04 CEST 2001

On 4 Sep 2001, Rolo Tomasi wrote:

> Is is possible to create C-based extension modules to Python
> without using shared libraries?

Yes, but... why?

The only way to make a C-based extension for Python static is to link it with
the Python executable itself. You probably don't want to be doing that.

Or, you could write a C program and embed the Python interpreter in it. That
way the C program can create modules on its own and then the Python scripts
can import the modules and then use them.

Be sure that you want to use either of those methods instead of just knuckling
under and doing it in a shared library.

Ignacio Vazquez-Abrams  <ignacio at openservices.net>

More information about the Python-list mailing list