caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <lefessan@prof.inria.fr>
To: caml-list@inria.fr
Subject: Patch "shared-vm" for ocaml-1.06
Date: Fri, 21 Nov 1997 15:38:23 +0100	[thread overview]
Message-ID: <199711211438.PAA04383@spirou.inria.fr> (raw)


I updated my shared-vm patch for ocaml-1.06. It can be found in:

http://www-sor.inria.fr/~lefessan/src/shared-vm.tar.gz

both for ocaml-1.05 and ocaml-1.06.

It enables you to create new virtual machines extended with C
libraries and Ocaml bytecode files. As a result, executables using
these libraries are compiled faster (no -custom option needed) and are
really smaller. If you often use the "otherlibs/" libraries, you
should really use it.

Here is the README file for the patch (French and English):

--------------------------------------------------------------------------
Francais/French:

Releases 1.05 et 1.06

INTERET:
 
  Ce patch permet de créer des exécutables OCAML utilisant des librairies
C et CAML sans avoir besoin d'utiliser l'option -custom. Cela évite de 
recréer une machine virtuelle dans chaque exécutable. Le temps de 
compilation est donc nettement réduit, et l'exécutable, qui ne contient plus
que le bytecode réellement propre à l'application, a une taille
largement inférieure et est plus portable.

INSTALLATION:

Placez-vous à la racine de la distribution ocaml-1.06. Le répertoire
doit donc contenir ./ocaml-1.06/

Appliquez le patch: patch < patch.ocaml-1.06
Puis recompilez: make (ou make world la première fois)

UTILISATION:

Ce patch permet de créer de nouvelles machines virtuelles, contenant à 
la fois des librairies C et du bytecode préchargé.

Pour cela, il ajoute deux nouvelles options:

-make_vm : indique que l'on doit créer une nouvelle machine virtuelle 
  ( le nom de la machine est précisé par l'option -o )

-use_vm <vm> : indique que le fichier généré utilisera la machine
   virtuelle <vm> (précisez le chemin complet)

EXEMPLE:

# ocamlc -thread -make_vm -o ocamlthreadrun -cclib "-lunix -lthreads" \
 unix.cma threads.cma

Cette commande génère deux fichiers:
 - ocamlthreadrun : la nouvelle machine virtuelle, contenant en plus la 
librairie Unix et la librairie Threads, ainsi que les bytecodes de
stdlib.cma, unix.cma et threads.cma
 - ocamlthreadrun.cmc : ce fichier contient les informations nécéssaires 
à la création des exécutables utilisant ocamlthreadrun comme machine 
virtuelle

# mv ocamlthreadrun /usr/local/bin/
# mv ocamlthreadrun.cmc /usr/local/lib/ocaml-1.06

On déplace ces fichiers vers leur emplacement définitif.
ocamlthreadrun.cmc doit impérativement se trouver dans le chemin où le 
compilateur recherchera les fichiers (librairie standard et répertoires
précisés par -I). 

# ocamlc -thread -use_vm /usr/local/bin/ocamlthreadrun -o client client.ml

On compile le fichier client.ml et on crée l'exécutable client.
La machine virtuelle est référencée avec un chemin absolu qui est stocké 
dans l'exécutable (#!/usr/local/bin/ocamlthreadrun en première ligne).
L'exécutable client ne contient que le bytecode de client.ml (stdlib.cma,
unix.cma et threads.cma sont dans la machine virtuelle). Si l'on
compile ocamlthreadrun sur différentes architectures, l'exécutable 'client'
sera donc utilisable par toutes ces machines.

# ./client
# ocamlthreadrun ./client

Pour exécuter notre fichier

--------------------------------------------------------------------------
Anglais/English(bad):

INTEREST:
 
  This patch enable you to create OCAML programs using C and OCAML libraries
without using -custom option. Then, you will not create a new virtual machine
for each program. The compilation time is slightly decreased, and the
executable program, which only contains the own bytecode of your
application, is much smaller and more portable. 

INSTALLATION:

Go in the root of ocaml-1.06 distribution. Your directory should contain
 ./ocaml-1.06/

Apply the patch: patch < patch.ocaml-1.06
Then compile again: make (or make world the first time)

UTILISATION:

  This patch enable you to create new virtual machines, containing both
C libraries and OCAML pre-loaded bytecode.

For that, you have two new options:

-make_vm : To say you want to create a new virtual machine
  ( use -o option to choose the virtual machine name)

-use_vm <vm> : To say that the program you're linking will use
   virtual machine <vm> (full absolute path) 

EXAMPLE:

# ocamlc -thread -make_vm -o ocamlthreadrun -cclib "-lunix -lthreads" \
 unix.cma threads.cma

This command will create two files:
 - ocamlthreadrun : The new virtual machine, containing library Unix and
library Threads, and also stdlib.cma, unix.cma and threads.cma bytecodes.
 - ocamlthreadrun.cmc : This file contains information needed to create
programs using ocamlthreadrun virtual machine.

# mv ocamlthreadrun /usr/local/bin/
# mv ocamlthreadrun.cmc /usr/local/lib/ocaml-1.06

We move the files to their right locations.
ocamlthreadrun.cmc must be in the path where ocamlc will search files 
during linking (standard library and directories in -I option)

# ocamlc -thread -use_vm /usr/local/bin/ocamlthreadrun -o client client.ml

We compile client.ml and create executable file 'client'.
The absolute path of the virtual machine will appear in the executable
file (#!/usr/local/bin/ocamlthreadrun in first line).
The file 'client' only contains bytecode for client.ml (stdlib.cma,
unix.cma and threads.cma are already in the virtual machine ocamlthreadrun).
You can compile ocamlthreadrun on different machines, and use only one
version of 'client' on all of them.

# ./client
# ocamlthreadrun ./client

To execute file 'client'

---------------------------------------------------------


-- Fabrice LE FESSANT
Projet PARA, INRIA Rocquencourt
Fabrice.Le_Fessant@inria.fr
http://www-sor.inria.fr/~lefessan







             reply	other threads:[~1997-11-21 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-21 14:38 Fabrice Le Fessant [this message]
1997-11-21 18:26 ` type recursifs et abreviations cyclique and Co Emmanuel Engel

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=199711211438.PAA04383@spirou.inria.fr \
    --to=lefessan@prof.inria.fr \
    --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).