caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Big executables from ocamlopt; dynamic libraries again
@ 2002-03-16 16:05 Tim Freeman
  2002-03-18  1:12 ` Jacques Garrigue
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Freeman @ 2002-03-16 16:05 UTC (permalink / raw)
  To: caml-list


When I compile a simple "hello world" app using lablgtk, the resulting
executable exceeds 800KB.  With a few apps like this, my package will
take offensively long to download, even over DSL.  The exectuable
seems to be including most of the lablgtk library in the executable,
which makes sense because lablgtk is statically linked in the
executable.

This isn't a problem with lablgtk.  A native code app that just prints
"hello world" on standard output takes 5K bytes if written in C but
95K in ocaml.  

The GTK executable would be smaller if lablgtk were dynamically linked
into it.  I hear that a real shared library isn't an option because
the present ocaml compiler can't generate position independent code.
However, one can do dynamic linking on many machines without position
independent code or a shared library; the dynamic linker just
relocates the library at run time.

I'd really rather write something in OCAML than the other languages
available, but if the resulting executables are so huge that I can't
distribute binaries, that's a problem.  If I controlled the libraries
myself, I could use the scaml patch from
http://algol.prosalg.no/~malc/scaml/, but I'd much rather use the
lablgtk that comes in Debian than package it myself, and I'd rather
not stick my users with a redundant copy of the lablgtk library.

Is there any reason there's no support for writing dynamically
linkable libraries in OCAML?

Hmm, if you memorized the MD5 checksum of the library at compile time,
and checked it at run time, it could even be type safe.  Or you could
just memorize the MD5 of the signature of the library, in some sense;
this would allow patches like the recent zlib double-free.  If the
library knows it's checksum, and the code loading it knows the
expected checksum, then you can do this checking without computing a
checksum at run time.

-- 
Tim Freeman       
tim@fungible.com; formerly tim@infoscreen.com
-------------------
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


^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: [Caml-list] Big executables from ocamlopt; dynamic librariesagain
@ 2002-03-18 10:50 Dave Berry
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Berry @ 2002-03-18 10:50 UTC (permalink / raw)
  To: Jacques Garrigue, caml-list

Do .cmi files use hash-consing?  This can greatly reduce the size of
type information.

-----Original Message-----
From: Jacques Garrigue [mailto:garrigue@kurims.kyoto-u.ac.jp]
Sent: 18 March 2002 05:20
Subject: Re: [Caml-list] Big executables from ocamlopt; dynamic
librariesagain

...
If you've got a look at the size of some .cmi's, you may
realize that including required types in executables may require
potentially huge sizes.
...
-------------------
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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-03-20  4:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-16 16:05 [Caml-list] Big executables from ocamlopt; dynamic libraries again Tim Freeman
2002-03-18  1:12 ` Jacques Garrigue
2002-03-18  1:29   ` Tim Freeman
2002-03-18  5:20     ` Jacques Garrigue
2002-03-18 10:10       ` [Caml-list] Big executables from ocamlopt; dynamic librariesagain Warp
2002-03-18 13:14       ` [Caml-list] Big executables from ocamlopt; dynamic libraries again Sven
2002-03-18 15:51       ` [Caml-list] Type-safe backward compatibility for .so's Tim Freeman
2002-03-18 18:46       ` [Caml-list] Big executables from ocamlopt; dynamic libraries again malc
2002-03-19 22:21       ` Johan Georg Granström
2002-03-20  2:46         ` Hashing research (was Re: [Caml-list] Big executables ...) Tim Freeman
2002-03-18 10:12     ` [Caml-list] Big executables from ocamlopt; dynamic libraries again Nicolas George
2002-03-18 13:11   ` Sven
2002-03-18 10:50 [Caml-list] Big executables from ocamlopt; dynamic librariesagain Dave Berry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).