Python linker

Alex Martelli aleax at mac.com
Thu Jul 20 11:33:37 EDT 2006


Ben Sizer <kylotan at gmail.com> wrote:

> Sion Arrowsmith wrote:
> > Er, what? How are you generating your standalone executables? What
> > size is "acceptable"? python24.dll is only 1.8M -- surely on any
> > non-embedded platform these days 1.8M isn't worth bothering about.
> > And since you mention wx (all of another 4.8M) I'd guess we're
> > talking about desktop applications. Who's going to notice if your
> > executable is a couple of M slimmer?
> 
> I've considered making a few lightweight GUI apps in the past but you
> just can't do it with wxPython. When you have similar products done in
> Visual C++ weighing in at kilobytes rather than megabytes, it's hard to
> convince people that it's worth downloading your product. Say I wanted

What framework (if any) is your Visual C++ code using?  If it's using
wxWidgets (the framework underlying wxPython) I very much doubt that it
can be a few kilobytes -- unless the wxWidgets DLL is already installed
on the target machines so that it doesn't need to be packaged together
with the application code.


> to develop a simple Notepad clone with 1 or 2 extra features: the MS
> executable is 68Kb, yet to simulate it in wxPython would be over 5MB;
> nobody would want it. I suppose you can use the msvcrt library directly
> and cut out wx from the dependencies, but sadly the Python overhead is
> still a slight deterrent.
> 
> Not that I see an easy solution to this, of course.

The easy solution is to compare apples with apples: if, in your
application space, it is crucial to use only DLLs that are already
installed on the target machines, you can do that from Python (with
ctypes, for example) just as you can from C.  Of course, coding to
(e.g.) the Win32 API directly is not to everybody's tastes, but it's
just about as bad in any language.

Of course, if you believe that the runtime libraries for a given
language (Visual Basic N for some specific value of N, Visual C++ M for
some specific value of M, ...) are going to be already installed on the
target machine, then the hypothetical constraint says that you must use
that specific language and version.  For example, nobody will ever
program applications in VB6, because at some point in time the runtime
libraries for VB5 were widespread and those for VB6 were not, so a
program prepared for VB5 could be distributed as a much-smaller package.

What generally happens in the real world is rather different:
applications get programmed in whatever language and release/version is
handy, and the runtimes are separately offered for download and install
to those users who have not yet installed any previous application using
the same language and release/version.  For example, msvcr80.dll is
indispensable to use programs written with Microsoft Visual Studio 2005,
and you'll find thousands of sites on the web offering it for separate
download and installation; mfc80u.dll, similarly (albeit only at
hundreds of sites;-); and so on, and so forth.

The situation is quite similar for other languages, Python included, and
other frameworks, wxWidgets (and wxPython on top it it) included.


Alex



More information about the Python-list mailing list