Version française
Home     About     Download     Resources     Contact us    
Browse thread
Native multithreaded LablGTK2?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Julien Moutinho <julien.moutinho@g...>
Subject: Re: [Caml-list] Native multithreaded LablGTK2?
On Sun, Jul 29, 2007 at 09:16:08PM +0200, Kaspar Rohrer wrote:
> I'm trying to build a multithreaded application (my own, written from 
> scratch) using Ocaml, Lablgtk2, and Lablgl. I use Omake as the build 
> system, and the project consists of several different Ocaml libraries (my 
> own as well as 3rd party).
>
> Here's the error I get when I try to compile the application:
>
> Files /Users/krohrer/godi/lib/ocaml/pkg-lib/lablgtk2/gtkThread.cmx
> and /Users/krohrer/godi/lib/ocaml/pkg-lib/lablgtk2/gtkThread.cmx
> both define a module named GtkThread
Sounds like you end up with a doubloon amongst the dependences.

> This only happens when I try to compile a native code application, as 
> opposed to byte code.
That's because ocamlc removes doubloons for you, while ocamlopt does not.

$ echo "let f () = print_endline \"Namaste\"" > dep.ml
$ ocamlc -c dep.ml
$ ocamlopt -c dep.ml
$ echo "Dep.f ()" > file.ml
$ ocamlc -o file dep.cmo dep.cmo file.ml && ./file
Namaste
$ ocamlopt -o file.opt dep.cmx dep.cmx file.ml && ./file.opt
Files dep.cmx and dep.cmx both define a module named Dep

> Now, my knowledge of the ocaml library system is somewhat limited. So I 
> thought I'd ask here, in the hope that if this is really a 
> lablgtk2/godi/omake error, somebody will tell me.
> Any ideas on this one?
Check the META.lablgtk2 file:
$ ocamlfind query lablgtk2 -format "%A" -predicates native,mt
lablgtk.cmxa gtkThread.cmx

If you get this, lablgtk2 is not likely to be guilty.

For I have never used neither Omake nor Godi, cannot help more.
Nonetheless, if I were you I would dive into Omake...

> PS: Currently the application is single threaded, but due to output 
> redirection using pipes, I get the occassional freeze. (Pipe gets flooded!)
Weird.