English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Linking problem with thread libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-02-21 (20:03)
From: Galchin Vasili <vngalchin@y...>
Subject: [Caml-list] Linking problem with thread libraries

  I have written a lot of software with POSIX threads
and Win32 API threads so the OCaml thread API looks
very familiar. I am compiling on Linux which doesn't
support LWPs but instead implements pthreads ("native"
threads via the "clone" system call). I got lost in
the following narrative from the in-progress book
(nice book BTW ...!): 

This library is not part of the execution library of
Objective CAML. Its use requires the option -custom
both for compiling programs and for constructing a new
toplevel by using the commands: 
$ ocamlc -thread -custom threads.cma  files.ml -cclib
$ ocamlmktop -tread -custom -o threadtop thread.cma
-cclib -lthreads

The Threads library is not usable with the native
compiler unless the platform implements threads
conforming to the POSIX 10031. Thus we compile
executables by adding the libraries unix.a and

$ ocamlc -thread -custom threads.cma files.ml -cclib
-lthreads \
  -cclib -lunix -cclib -lpthread
$ ocamltop -thread -custom threads.cma files.ml -cclib
-lthreads \
  -cclib -lunix -cclib -lpthread
$ ocamlcopt -thread threads.cmxa files.ml -cclib
-lthreads \
  -cclib -lunix -cclib -lpthread

Perhaps somebody could tell me the difference between
the two invocations of "ocamlc" above!?

Thanks, Vasili

Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.

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