Browse thread
Multi-threaded programs using MinGW x-compiler
-
Paul Steckler
- Richard W.M. Jones
- Török_Edwin
[
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: | -- (:) |
| 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 ;;
EOF
$ i586-mingw32msvc-ocamlopt -thread unix.cmxa threads.cmxa x.ml
$ WINEDEBUG=-all wine camlprog.exe
(0)(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)
$ 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,
--Edwin