Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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 -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 -cclib
-lthreads \
  -cclib -lunix -cclib -lpthread
$ ocamltop -thread -custom threads.cma -cclib
-lthreads \
  -cclib -lunix -cclib -lpthread
$ ocamlcopt -thread threads.cmxa -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 Archives:
Bug reports: FAQ:
Beginner's list: