How to make python24.dll smaller ?

S

Stormbringer

Hello,

I am trying to make an executable for one of my applications with cx
freeze. All works ok although I must include python24.dll with it if I
want to redistribute it. The big problem is python24.dll size, it's 1.8
MB and I am sure I don't need much of what's in there.

I downloaded python source code and built the dll using the VC 7.1
project (directory PCBuild/), still can't figure out how I can tweak
the project so I get smaller dll - for example is there a way to find
out what modules are included, what is the approx size they take inside
the dll and how can I not include them by default ?

Thanks,
Andrei
 
S

Stormbringer

Ok, for anyone interested on the issue: I have found the solution. I
commented out some module lines inside config.c (modules I know for
certain I will not use) and removed the module .c files from the
project.

Biggest save was when I removed the Asian character encodings, reduced
size by about 650 KB.

I also changed the build options to link against multithreaded libs,
not multithreaded dll libs (which makes python24.dll dependent on
msvcr71.dll which in turn is not present on some people's computers and
would have to be distributed in that case).

Final result: a 1.1 MB python24.dll which works with my frozen apps and
is not dependent on msvcr71.dll and compressed goes to around 440 KB.
And I'm sure that depending on the project I still could trim some more
modules out.

Andrei
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Stormbringer said:
Final result: a 1.1 MB python24.dll which works with my frozen apps and
is not dependent on msvcr71.dll and compressed goes to around 440 KB.
And I'm sure that depending on the project I still could trim some more
modules out.

If you are building yourself, anyway, I recommend an even more drastic
approach (which, alas, requires more work also): build a static library
for all the extension modules, and then use freeze to generate the
config.c. Linking it all together will bring in just those modules which
are actually referenced in config.c, and freeze will guess what modules
to put into config.c based on import statements. You might be able
to trim it further by explicitly excluding modules on the freeze command
line if you happen to know that some import statements are never
executed in your application (this is actually worthwhile for the
Python modules as well).

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top