C extensions without using shared libraries

Rolo Tomasi rolo at foobar.org
Wed Sep 5 03:55:45 CEST 2001


On Tue, 4 Sep 2001 19:35:04 -0400 (EDT), Ignacio Vazquez-Abrams <ignacio at openservices.net> wrote:
>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?
>

Of course the obvious answer is if you need to run your extension/s on a system
that doesn't support shared libraries.  I've ported Python 2.1.1 to the 
system, but need to run my extensions too.


>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.
>

knuckling under is not an option in this case. shared libraries are not supported
on the system.





More information about the Python-list mailing list