Browse thread
effect of -thread with ocamlc/ocamlopt -c
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-09-12 (17:07) |
From: | Trevor Jim <trevor@r...> |
Subject: | effect of -thread with ocamlc/ocamlopt -c |
I have a question about the effect of -thread when used with ocamlc/ocamlopt -c. The manual states: All object files on the command line must also have been compiled with the -thread option However, in compiling a large number of files I have not yet found a case where -thread made a difference in the output of ocamlc or ocamlopt (provided of course that module Thread is not used). In other words, the binary output is identical. So, in general, can I take a .cmo or .cmx file that was NOT compiled with -thread and link it with the threads library threads.cma or threads.cmxa? And, in general, can I take a .cmo or .cmx file that WAS compiled with -thread but which does not use module Thread, and link it into a program without the threads library? Here's why this matters to me. I have a large app (galax, with 300+ modules) that started out unthreaded. I have added a threaded server, which extends the app with one file that uses the Thread module. So I have a server that needs to be threaded, plus all the old programs (galax compiler, etc.) that don't need to be threaded. Linking in the threads library causes the programs that don't use or need threads to slow down by 2-30 times. Since the program is so large, I would prefer not to have to compile each module twice, once with threads and once without. Also, it relies on a large number of libraries. I don't want to have to have two versions of each library. But the manual seems to imply that I need to do that. -Trevor