adobe-flash / crossbridge

Welcome to visit the homepage!
http://www.crossbridge.io
542 stars 196 forks source link

10_MessageChannel built into a 2.9MB swf file #39

Open trungnq97 opened 10 years ago

trungnq97 commented 10 years ago

Hi,

I tried to run make in sample 10_MessageChannel, and the output file is 2.9MB. It seems to be quite big compared to a very small cpp file.

I am wondering, is there any way to reduce its size?

Best, Trung

trungnq97 commented 10 years ago

When building with -O4 -flto-api=exports.txt, my swf file now is only 212K. The exports.txt is taken from example 9 pthreads. Still this exports.txt is mysterious to me. Can anybody explain where these symbols come from? (Or how to build this list of symbols?).

built in symbols that must always be preserved

_start1 malloc free memcpy memmove flascc_uiTickProc _sync_synchronize

symbols for C++ exception handling

_Unwind_SjLj_Register _Unwind_SjLj_Resume _Unwind_SjLj_Unregister _Unwind_SjLj_RaiseException

symbols specific to libVGL

vglttyioctl

I did two simple tests:

Remove "

symbols specific to libVGL

vglttyioctl " .. no output from printf

Remove "

symbols for C++ exception handling

_Unwind_SjLj_Register _Unwind_SjLj_Resume _Unwind_SjLj_Unregister _Unwind_SjLj_RaiseException " .. the swf stops working.

cbakgly commented 10 years ago

These are native symbols in libc. If you ever write a helloworld.cpp, don't you wonder how such a small app prints out "hello world"? Never forget you have OS/Libs supporting you. Now you bring part of them along in your swf file to support you again.