Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Executable size?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Kamil Shakirov <kamils@i...>
Subject: Re: [Caml-list] Executable size?
Hello,

--------- hello.cc ---------------
#include <iostream>

using namespace std;

int main ()
{
	cout << "Hello, world!" << endl;
	return 0;
}
--------- hello.ml ---------------
let _ = print_endline "Hello, world!";;

kamil$ uname -a
Linux tornado.force 2.4.22 #1 Fri Oct 24 12:29:16 MSD 2003 i586 i586 i386 GNU/Linux

kamil$ gcc --version
gcc (GCC) 3.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

kamil$ ocamlc -version 
3.07[+Shared]

kamil$ g++ -Os -o hello_cpp hello.cc && strip hello_cpp && ldd hello_cpp
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4001d000)
        libm.so.6 => /lib/libm.so.6 (0x400d1000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400f2000)
        libc.so.6 => /lib/libc.so.6 (0x400fa000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

kamil$ ocamlopt -compact -o hello_mln hello.ml && strip hello_mln && ldd ./hello_mln
        libm.so.6 => /lib/libm.so.6 (0x4001c000)
        libdl.so.2 => /lib/libdl.so.2 (0x4003e000)
        libc.so.6 => /lib/libc.so.6 (0x40041000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

kamil$ g++ -Os -static -o hello_cpp_stat hello.cc && strip hello_cpp_stat

kamil$ ocamlopt -compact -ccopt -static -o hello_mln_stat hello.ml \
       && strip hello_mln_stat

kamil$ ls -l hello_*
-rwxr-xr-x    1 kamil    homeusers     3988 Nov 13 07:00 hello_cpp
-rwxr-xr-x    1 kamil    homeusers   787660 Nov 13 07:00 hello_cpp_stat
-rwxr-xr-x    1 kamil    homeusers    72044 Nov 13 07:00 hello_mln
-rwxr-xr-x    1 kamil    homeusers   458236 Nov 13 07:02 hello_mln_stat

It is more fair in relation to the OCaml. ;)

-- 
 Kamil.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners