caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: tim@fungible.com (Tim Freeman)
To: caml-list@inria.fr
Subject: [Caml-list] Big executables from ocamlopt; dynamic libraries again
Date: Sat, 16 Mar 2002 09:05:50 -0700	[thread overview]
Message-ID: <9601-Sat16Mar2002094255-0800-tim@fungible.com> (raw)


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


             reply	other threads:[~2002-03-16 17:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-16 16:05 Tim Freeman [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9601-Sat16Mar2002094255-0800-tim@fungible.com \
    --to=tim@fungible.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).