Loading C extension from memory

Roger Binns rogerb at rogerbinns.com
Thu May 20 01:58:34 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/13/2010 06:14 AM, mk wrote:
> I wonder if there is a way to load C extension from in-memory object,
> not from the file on the disk?
> 
> I'm asking bc I would like to download C extensions over network and
> load them into Python interpreter (without storing the C extension in
> file on the disk).

You could download the C source over the network, compile and use that.  It
has the advantage of working on all platforms where you have a compiler so
you wouldn't have to have the same extension compiled for Mac, Linux,
Windows, 32 and 64 bit.

If the local machine doesn't have a compiler you can even use libtcc or
something newer.  For example see this 3 year old page, as well as links at
the bottom:

  http://www.cs.tut.fi/~ask/cinpy/

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkv0z4UACgkQmOOfHg372QQ1UQCg2+ODiHMzi36//gG3gK6j4Uib
2u8AoMI2LXU7BFYa7Jn5b+vF42/EnNYU
=RWO+
-----END PGP SIGNATURE-----




More information about the Python-list mailing list