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
Multi-threaded programs using MinGW x-compiler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-05-24 (12:22)
From: Török_Edwin <edwintorok@g...>
Subject: Re: [Caml-list] Multi-threaded programs using MinGW x-compiler
On 2010-05-24 04:39, Paul Steckler wrote:
> Has anyone gotten an OCaml multithreaded program to build for Win32 native threads using the
> MinGW ocaml cross-compiler?

I'm not a windows user, but I tried with Debian's mingw32-ocaml package
and wine: it seems to work. I don't know if it uses native threads or
not, but it does import CreateThread.

Here is what I did:
$ cat >x.ml <<EOF
let f_proc1 () = for i=0 to 10 do Printf.printf "(%d)" i; flush stdout done;
                  print_newline() ;;
let t1 = Thread.create f_proc1 () ;;
Thread.join t1 ;;
$ i586-mingw32msvc-ocamlopt -thread unix.cmxa threads.cmxa  x.ml
$ WINEDEBUG=-all wine camlprog.exe
$ i586-mingw32msvc-nm camlprog.exe |grep Thread
0042da60 T _CreateThread@24
0042daa0 T _GetCurrentThread@0
0044f3b4 I __imp__CreateThread@24
0044f3e0 I __imp__GetCurrentThread@0
0042ec9c D _camlThread
0042ef98 D _camlThreadUnix

Best regards,