[Python-ideas] Calling python from C completely statically
Nick Coghlan
ncoghlan at gmail.com
Sun Jul 8 10:07:34 EDT 2018
On 8 July 2018 at 21:34, Paul Moore <p.f.moore at gmail.com> wrote:
> This question is probably more appropriate for python-list, but yes,
> you certainly can do this. The "Embedded" distributions of Python for
> Windows essentially do this already. IIRC, they are only available for
> Python 3.x, so you may find you have some hurdles to overcome if you
> have to remain on Python 2.7, but in principle it's possible.
>
> One further point you may need to consider - a proportion of the
> standard library is in the form of shared C extensions (PYDs in
> Windows - I don't know if you're using Windows or Unix from what you
> say above). You can't (without significant extra work) load a binary
> extension direct from a zip file, so you'll need to either do that
> extra work (which is platform specific and fragile, I believe) or be
> prepared to ship supporting DLLs alongside your application (this is
> the approach the embedded distribution takes).
That's the part of the problem that Alberto's static linking solves -
all of the standard library's extension modules are top level ones (at
least as far as I am aware), so we support building them as statically
linked builtin modules instead (we just don't do it routinely, because
we don't have any great desire to make the main executable even larger
than it already is).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list