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: skaller <skaller@o...>
Subject: Re: [Caml-list] Executable size?
On Thu, 2003-11-13 at 05:21, John J Lee wrote:
> On Wed, 12 Nov 2003, Richard Jones wrote:

> Probably this is a naive question, but: Is it impractical to have a
> functional language that uses the C runtime?

Felix does that. Its own runtime is tiny
(it has a naive exact garbage collector .. only a page of
source code or two).

It also generates shared libraries by default, which don't
include any runtime at all (you invoke the library with
a driver like ocamlrun).

Here is the Hello World program in Felix:
-----------------------
include "std";
print "Hello World\n";
-------------------------

and the output for Linux x86 generated by g++ without optimisation:

  20 -rwxrwxr-x    1 skaller  skaller     18847 Nov 15 02:23 tut101.so

It is run by this program:

  72 -rwxrwxr-x    1 skaller  skaller     69083 Nov 15 02:19 flx_run

[Of course the C and C++ libraries are dynamically linked so are
not included]

> Does anyone have recommendations for languages (not necessarily
> functional) with a compiler that generates small executables (including
> runtime code) for multiple platforms (at least Unix and Windows), with a
> decent FFI (foreign function interface), and preferably MS COM support?
> 
> Am I really stuck with C++??

Felix generates simple ISO C++, so the output is portable.

The foreign function interface  .. well .. example:

header "include <cstdio>";
type file = "FILE*";
fun fopen: string -> file = 'std::fopen($1.data(),"rt")';

MS_COM support you'll have to add yourself.
Should be trivial using the above kind of mechanism.

http://felix.sf.net

It works fine on Linux and has been built with
Cygwin on Windows. Ocaml, Python, and a C++ compiler 
are required. And some courage since it is 'pre-alpha'
software :-)

Read the tutorial to discover the functional features
including first class functions, currying, pattern matching,
etc. Note that polymorhism is fully parametric but compile
time only at the moment since boxing is not used.


-------------------
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