Have you tried using another compiler like **g++**?
**g++** has a lot of [optimization options][1], most notably **-Os**.
I haven't created shared libraries yet, so the following might not be correct or the best way to do it, but it might help you:
g++ -Os -fPIC -shared test1.cc -o test1.o
g++ -Os -fPIC -shared test2.cc -o test2.o
g++ -shared -Os test1.o test2.o -o libtest.so
ls -lA
-rwxr-xr-x 1 jazz users 5616 19. Mai 15:08 libtest.so
-rw-r--r-- 1 jazz users 19 19. Mai 14:59 test1.cc
-rwxr-xr-x 1 jazz users 6500 19. Mai 15:09 test1.o
-rw-r--r-- 1 jazz users 19 19. Mai 14:59 test2.cc
-rwxr-xr-x 1 jazz users 6500 19. Mai 15:03 test2.o
<br/>
Furthermore, I changed
#include<iostream.h>
to
#include<iostream>
in the *test-files*. The difference is explained [here][2].
<br/><br/><br/>
You can also use **strip**! Strip can reduce the size of the object file by a significant amount, but debugging is hindered afterwards.
<br/><br/><br/>
All this was done on the following *x86_64 system*:
Linux substitutedhostname 2.6.38-ARCH #1 SMP PREEMPT Fri May 13 09:24:47 CEST 2011 x86_64 Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz GenuineIntel GNU/Linux
You can also use **strip**! Strip can reduce the size of the object file by a significant amount, but debugging is hindered afterwards.
[1]: http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
[2]: http://www.decompile.com/cpp/faq/diff_btw_h_and_no_h.htm