From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p240HVxS006763 for ; Fri, 4 Mar 2011 01:17:31 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicEABC+b03RVdg2kGdsb2JhbACYMDGNfwgVAQEBAQkJDAcRBCGjVoolgh2FJS+IWwEBAwWFXASFFIcYhlqBfTo X-IronPort-AV: E=Sophos;i="4.62,261,1297033200"; d="scan'208";a="77050206" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Mar 2011 01:17:25 +0100 Received: by qwj8 with SMTP id 8so1844881qwj.27 for ; Thu, 03 Mar 2011 16:17:24 -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=Y9VLiKd0aIbzAMZnrni40y5sWk/jlQGIduV6k7icEiw=; b=UZuxT8/zU1LTaEZ6ScV0/hwiufNEQfQO2f1N4+JOvJL9nt9l7qkdIwSxTL+iNF3X6P 2Gt8wrqCxENb8sy5vSyZp1N9FNxVyCeBEwv5kVDY8YO8rF5hiABmMTaq5eZCfkmvHlfW ChHGV1AdIgXyWaCcUHH0IAp99Ishsd84S7cJA= 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=GHf8BfLNJSrXMp4c2Xqnma+2TlQmJLCN0M/qzMb2DG/iKtxXDdi+/ddxgM0yO6xKgj txgqoBtiGS57RThe2Ozqf6N4lSJDMd7MXIwk8ONnblR2tepLpwIa9NYBBx7oTj6hkmsu rdKdPZOB54e9QSNVUauyEWMSSbeCtr1RvgGfQ= MIME-Version: 1.0 Received: by 10.229.241.194 with SMTP id lf2mr1530296qcb.222.1299197844173; Thu, 03 Mar 2011 16:17:24 -0800 (PST) Received: by 10.229.96.136 with HTTP; Thu, 3 Mar 2011 16:17:24 -0800 (PST) In-Reply-To: References: Date: Fri, 4 Mar 2011 03:17:24 +0300 Message-ID: From: Dmitry Bely To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p240HVxS006763 Subject: Re: [Caml-list] Using C threads I see. Not ocaml thread function is used so threads.cma is not linked. You are right. Probably this deserves a bug report: caml_c_thread_register() can check that no master lock still exists and initialize it if necessary. - Dmitry Bely On Fri, Mar 4, 2011 at 2:46 AM, Niki Yoshiuchi wrote: > 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 >> >> > > > -- > 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 > >