From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p23NkCkd005794 for ; Fri, 4 Mar 2011 00:46:12 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AigEAEO3b03RVdivkGdsb2JhbACEKpQFMY1/CBUBAQEBCQkMBxEEIaNGiWk8gh2FIC+IWwEBAwWBIoNEdgSFGocShlqBfTo X-IronPort-AV: E=Sophos;i="4.62,261,1297033200"; d="scan'208";a="89138525" Received: from mail-qy0-f175.google.com ([209.85.216.175]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Mar 2011 00:46:07 +0100 Received: by qyk35 with SMTP id 35so392772qyk.6 for ; Thu, 03 Mar 2011 15:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=V2F8cM1MYxh7lITF6O4+zHB9gXZr1JNw/OsPqLLaszo=; b=sQqUw8MSsUPJhA6Qx/2EmoGHrrRIPPLT8hurlH3xZeW8gZgWIamT4C8hBWfvRJPPRN Oo2NWgVdzc2Tq0A3L4HjzPJZLVXQxnMir52lTJqVyyq73KKLasCfGI+XYt/fx7TagFLG SyLimyKjDn77igCklrlGnV8iTfPumcVgWbq/k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=gJMhdItb/YnjU+cO4oCkRobnz58UrbDLetbpf/SqjGMTO8dtd3HZWmLLTwyAI87q2k EhLjIfScmhTjaHOPkOxmEfDMj11H4ZtSz7bzmha6gQEhNFy2gXHhFyKvdsgm2SAoiSYj lRF9/M8Gd09FMDjzgj/+BEhVaG7CpGeg/YRWM= MIME-Version: 1.0 Received: by 10.224.80.212 with SMTP id u20mr1702451qak.128.1299195965668; Thu, 03 Mar 2011 15:46:05 -0800 (PST) Received: by 10.229.102.7 with HTTP; Thu, 3 Mar 2011 15:46:05 -0800 (PST) In-Reply-To: References: Date: Thu, 3 Mar 2011 18:46:05 -0500 Message-ID: From: Niki Yoshiuchi To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p23NkCkd005794 Subject: Re: [Caml-list] Using C threads My main program is in OCaml. Thread.thread_initialize is only called if you actually use the module in question. I tested this with some simple code: main.ml: (ocamlc -c main.ml) let _ = Printf.printf "Main\n" test.ml: (ocamlc -c test.ml) let _ = Printf.printf "Test\n" test2.ml: (ocamlc -o test2.cma -a test2.ml) let _ Printf.printf "Test2\n" ocamlc test2.cma test.cmo main.cmo ./a.out Test Main "Test2" never gets printed. On Thu, Mar 3, 2011 at 6:38 PM, Dmitry Bely wrote: > On Fri, Mar 4, 2011 at 2:23 AM, Niki Yoshiuchi wrote: >> Yes, I have (you can't use caml_c_thread_register() without it). >> However it appears that the flag doesn't run the code in the module. > > If you link your program as described in the manual: > > ocamlc -thread other options unix.cma threads.cma other files > ocamlopt -thread other options unix.cmxa threads.cmxa other files > > Thread.thread_initialize should be called automatically by ocaml > runtime during startup. If it's not called, something is broken in > your system. Do you have the main program in Ocaml? If not, do you > call caml_startup() from your C code? > > - Dmitry Bely > > -- > Caml-list mailing list.  Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >