From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id A06DF800BE for ; Thu, 9 Feb 2017 13:53:42 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=christoph.hoeger@celeraone.com; spf=Pass smtp.mailfrom=christoph.hoeger@celeraone.com; spf=None smtp.helo=postmaster@mail-io0-f172.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@celeraone.com) identity=pra; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@celeraone.com"; x-sender="christoph.hoeger@celeraone.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of christoph.hoeger@celeraone.com designates 209.85.223.172 as permitted sender) identity=mailfrom; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@celeraone.com"; x-sender="christoph.hoeger@celeraone.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-io0-f172.google.com) identity=helo; client-ip=209.85.223.172; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@celeraone.com"; x-sender="postmaster@mail-io0-f172.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AAJw82xebEUWosl7IMdBn0NjGlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxcSzYR7h7PlgxGXEQZ/co6odzbGH7+awBCdZvN6oizMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVr?= =?us-ascii?q?O+/7BpDdj9it1+C15pbffxhEiCCzbL52Ixi6twbcu8kZjYd/Kqs61wfErGZPd+?= =?us-ascii?q?lK321jOEidnwz75se+/Z5j9zpftvc8/MNeUqv0Yro1Q6VAADspL2466svrtQLe?= =?us-ascii?q?TQSU/XsTTn8WkhtTDAfb6hzxQ4r8vTH7tup53ymaINH2QLUpUjms86tnVBnlgz?= =?us-ascii?q?ocOjUn7G/YlNB/jKNDoBKguRN/xZLUYJqIP/Z6Z6/RYM8WSXZEUstXSidPAJ6z?= =?us-ascii?q?b5EXAuUDM+ZWr4fzqVgToxWgGQahH/ngxiNSi3LswaE2z+YsHAfb1wIgBdIOt3?= =?us-ascii?q?HUoc3rOacSS+C1zbLIzSnEb/NO2Tfy8IrGahYuof6SR7J7bM3cxlUvFwPfj1WQ?= =?us-ascii?q?spDlPzSN1uQNqWSb7+1gWvygi2E5sQF8uSSgydkoiobXnIIa0FfE9SNnz4ovOd?= =?us-ascii?q?K4T0t7bMeiHZBNuS+aMI52TdkjQ2FuoCs61qMJuYWnfCQQzZQnwwbTa+ebc4eV?= =?us-ascii?q?+h3sSumQITZkhH5/fbK/gxC/+lWjxO3kTsS4zkpGoy5fntTPtn0BzQLf5taJR/?= =?us-ascii?q?dn40us2yiD2gbO4e9eO080j7DUK5s5z74wiJUTtUPDEzfzmErsja+Wclwo+umv?= =?us-ascii?q?6+j7e7nmqIKQOo1qhg3kPaQuncu/Aes8MgcQRWSU5eO81Lj78U34RrVFkOE2n7?= =?us-ascii?q?HHvJzGIckXvK20Dg9P3oo99RqyAS2q3MkakHUZNF5FfQiIj4ntO1HAOvD4CvK/?= =?us-ascii?q?jkywnzdr3fDGP6bhAonKLnjbkLftZ7Z960lCxwo8099f/YlZBa0fL/L3REDxrs?= =?us-ascii?q?bXDhg/MwOq2eroFNJ91oYGVWKVHqCZKL/SsUOP5u83P+aDfooVuDLkJ/gh5v7u?= =?us-ascii?q?lmM5lEQGfaip2JsXcGq3Eu5nI0Wfe3rsg80OHX0EvgokH6TWjwikUDVUY/+paI?= =?us-ascii?q?U+6z0yP6gqF8+XQIGmh7iIx2G8HJBabyZMA0qkFXr4douFHfwLbXTBDNVml2kv?= =?us-ascii?q?VaKgUJMmzRGZlJH1xqAveuHU4CwDqZX71J514ODcmAsa/jFwAt6U1GeACWpzmz?= =?us-ascii?q?VbFHcNwKljrBklmR+42q9ijqkdTIQL6g=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C2AACNZZxYhqzfVdFdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFwEBBAEBCgEBhAeBCQeDUpwSlTaCDCKGAAKCXwdBFgEBAQEBAQEBAQEBEgE?= =?us-ascii?q?BAQgLCwodL4IzGwGCGgEBAQMBIx0BATcBBAsJAgsNKgICIhIBBQEcBhOJbAiSK?= =?us-ascii?q?pENP4saaIIlgwgBAQWINwEBAQEGAQEBAQEBGggSiymHWoJflVmEVIFIhm2DIIg?= =?us-ascii?q?Fgk6ON5FMFB6BFSYCgS1PURcFhBkgJYFJPzUBiH0BAQE?= X-IPAS-Result: =?us-ascii?q?A0C2AACNZZxYhqzfVdFdGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BhAeBCQeDUpwSlTaCDCKGAAKCXwdBFgEBAQEBAQEBAQEBEgEBAQgLCwodL4IzG?= =?us-ascii?q?wGCGgEBAQMBIx0BATcBBAsJAgsNKgICIhIBBQEcBhOJbAiSKpENP4saaIIlgwg?= =?us-ascii?q?BAQWINwEBAQEGAQEBAQEBGggSiymHWoJflVmEVIFIhm2DIIgFgk6ON5FMFB6BF?= =?us-ascii?q?SYCgS1PURcFhBkgJYFJPzUBiH0BAQE?= X-IronPort-AV: E=Sophos;i="5.35,349,1484002800"; d="scan'208,217";a="212634043" Received: from mail-io0-f172.google.com ([209.85.223.172]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 09 Feb 2017 13:53:41 +0100 Received: by mail-io0-f172.google.com with SMTP id j13so15789366iod.3 for ; Thu, 09 Feb 2017 04:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=celeraone-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=99aUIdhTQwUAOK/+qg+W4k2zNsgpQ1fL8xUbZRcZIZA=; b=edultkWYneEBcoQcKzAN7kZGA1gjGrkYzCuiBRE5s4TNtdCMg3v7pUSbLdBS5A14ie hQ3zOxZSJmFlNMrIaL1Y6UtSZl0wfnuiJrjvC1aVdBeKoW3K+1+Dz+kSZ00cQnecq6Cl zm+E2AZpKn/I5d21G3QK41rX3VpGh5RCUnv0EXQL97Ql2KtC4QJXzXQm5btU6dSdxifr 6O+3V9CvzuRwscuxEhpuo/xcElnuxMqXVyOPPb3TFldRjFPGUvsWgW4CKhAlrB3l7OOO PHJfypWlJ9zwzttnIOqTIDf+kYtYsWcQZV3IzeoZr8EApgPlT9tf3t+Qewz8UCntbyf0 Eq/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=99aUIdhTQwUAOK/+qg+W4k2zNsgpQ1fL8xUbZRcZIZA=; b=EP86NEbFhHqKh4JGZt8LInEEndEIL+rbm5SynLi9ZST3732R1PV07i0mXamaKJz+9S itmZlfmZjWI7vFvxxcQP2pXAONx0sshxROxYi7ZVfyFWOjInA5OzvLEEE6Z8XvJsHN2z /bnISDnpYkK1ngOXo3febHzUjJYCF1SvmGQJsnLTktrDeTawDD6sGCgW44eX5j1y/Gwb YAlCpqtpjVFGrA9aIsJy3f7zkEMbCfJR24zPANZhLMs7GGCsAR4Cibx3V9Wm+DCH0jMl NPZVxHUEENZ/u1lJFFXopf7uZdIoaqs+htHFgx9Wgs6ULNwbq+6DMbGDha1z5T8xV/NA 5NKw== X-Gm-Message-State: AMke39loc72j6cVGTvnNw9/lc6DUPko/hFywCRybz1XVZDLC43GC2l/iBP0EMNvIFszmR8nlX2q+blpKVVXA/6M4 X-Received: by 10.107.21.4 with SMTP id 4mr3260922iov.139.1486644819876; Thu, 09 Feb 2017 04:53:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.48.211 with HTTP; Thu, 9 Feb 2017 04:53:39 -0800 (PST) In-Reply-To: References: From: =?UTF-8?Q?Christoph_H=C3=B6ger?= Date: Thu, 9 Feb 2017 13:53:39 +0100 Message-ID: To: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= Cc: OCaml Mailing List Content-Type: multipart/alternative; boundary=94eb2c05ed12659ef9054818784f Subject: Re: [Caml-list] Is there some builtin function that flushes buffers on shutdown? --94eb2c05ed12659ef9054818784f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, that worked like a charm. As a side note: The order of arguments is important. test.ml std_exit.cmx will work, while std_exit.cmx test.ml will not. On Fri, Feb 3, 2017 at 12:37 PM, Nicol=C3=A1s Ojeda B=C3=A4r < nicolas.ojeda.bar@lexifi.com> wrote: > That should be std_exit.cmx, not std_exit.ml. > > Sorry about the typo. > > Cheers, > Nicolas > > > On Fri, Feb 3, 2017 at 11:52 AM, Nicol=C3=A1s Ojeda B=C3=A4r < > nicolas.ojeda.bar@lexifi.com> wrote: > >> Hi Christoph, >> >> You are right, but that is because std_exit.cmx does not get linked by >> default when using -output-obj, so >> in fact you need to add it by hand: >> >> ocamlfind opt -package ANSITerminal -linkpkg -verbose -output-obj -o >> test.object.o test.ml std_exit.ml >> >> Cheers! >> Nicolas >> >> >> >> On Fri, Feb 3, 2017 at 11:15 AM, Christoph H=C3=B6ger < >> christoph.hoeger@celeraone.com> wrote: >> >>> That sounded totally reasonable, but is not the cause. When I think >>> about it, it cannot work that way, since the linker should have complai= ned >>> about a missing symbol, right? >>> >>> On Fri, Feb 3, 2017 at 10:16 AM, Nicol=C3=A1s Ojeda B=C3=A4r < >>> nicolas.ojeda.bar@lexifi.com> wrote: >>> >>>> Hi Christoph, >>>> >>>> I can't check now, but it sounds like you forgot to link $(ocamlc >>>> -where)/std_exit.o into your executable. >>>> >>>> Cheers! >>>> Nicolas >>>> >>>> >>>> On Fri, Feb 3, 2017 at 9:56 AM, Christoph H=C3=B6ger < >>>> christoph.hoeger@celeraone.com> wrote: >>>> >>>>> Dear all, >>>>> >>>>> I managed to manually link and run an object file generated by >>>>> ocamlopt. A small part seems to be missing, however: >>>>> >>>>> =E2=9E=9C llvmlink ocamlfind opt -package ANSITerminal -linkpkg -ver= bose >>>>> -output-obj -o test.object.o test.ml >>>>> >>>>> =E2=9E=9C llvmlink clang -I$(ocamlc -where) -lm wrapper.c test.objec= t.o -o >>>>> wrapper ~/.opam/4.04.0/lib/ocaml/libunix.a -ldl >>>>> ~/.opam/4.04.0/lib/ocaml/libasmrun.a /home/choeger/.opam/4.04.0/lib >>>>> /ANSITerminal/libANSITerminal_stubs.a >>>>> >>>>> These commands produce an executable output, but the screen remains >>>>> empty. This changes, when I manually flush the stdout buffer in the c= ode (I >>>>> obtain the desired results then). >>>>> >>>>> Find attached the test sources. When I uncomment the Printf.printf in >>>>> test.ml, everything seems to work fine. But when I compile the test >>>>> using ocamlopt solely, this is not necessary. It seems some buffers d= o not >>>>> get flushed here. Does anyone know, why? >>>>> >>>>> regards, >>>>> >>>>> Christoph >>>>> >>>>> >>>> >>> >> > --94eb2c05ed12659ef9054818784f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks, that worked like a charm.

As a = side note: The order of arguments is important. = test.ml std_exit.cmx will work, while std_exit.cmx test.ml will not.

On Fri, Feb 3, 2017 at 12:37 PM, Nicol=C3=A1s Ojeda B= =C3=A4r <nicolas.ojeda.bar@lexifi.com> wrote:
=
That should be std_exit.cmx= , not std_exit.ml.
Sorry about the typo.

Cheers,
Nicolas


On Fri, Feb = 3, 2017 at 11:52 AM, Nicol=C3=A1s Ojeda B=C3=A4r <nicolas.ojeda= .bar@lexifi.com> wrote:
Hi Christoph,

You are right, but that is b= ecause std_exit.cmx does not get linked by default when using -output-obj, = so
in fact you need to add it by hand:

= =C2=A0 ocamlfind opt -package ANSITerminal -linkpkg -verbose -output-obj -o= test.object.o test.ml std_exit.ml
Cheers!
Nicolas



On Fri= , Feb 3, 2017 at 11:15 AM, Christoph H=C3=B6ger <christoph.ho= eger@celeraone.com> wrote:
That sounded totally reasonable, but is not the cause= . When I think about it, it cannot work that way, since the linker should h= ave complained about a missing symbol, right?

On Fri, Feb 3, 2017 at 10:16 AM, Nicol=C3=A1s Ojeda B=C3=A4r <nicolas.ojeda.bar@lexifi.com> wrote:
Hi Christoph,

I c= an't check now, but it sounds like you forgot to link $(ocamlc -where)/= std_exit.o into your executable.

Cheers!
Nicolas


On Fri, Feb 3, 2017 at 9:56 AM, Christoph H= =C3=B6ger <christoph.hoeger@celeraone.com>= wrote:
<= div>
Dear all,

I managed to manually link and run an objec= t file generated by ocamlopt. A small part seems to be missing, however:
=E2=9E=9C=C2=A0 llvmlink ocamlfind opt -package ANSITerminal -linkpkg = -verbose -output-obj -o test.object.o test.ml

=E2=9E=9C=C2=A0 llvmlink clang -I$(ocamlc -where= ) -lm wrapper.c test.object.o -o wrapper ~/.opam/4.04.0/lib/ocaml/libunix.a -ldl ~/.opam/4.04.0/lib/ocaml/libasmrun.a /home/choeger/.opam/4.= 04.0/lib/ANSITerminal/libANSITerminal_stubs.a

These = commands produce an executable output, but the screen remains empty. This c= hanges, when I manually flush the stdout buffer in the code (I obtain the d= esired results then).

Find attached the test sources. When I = uncomment the Printf.printf in test.ml, everything seems to work fine. But when I compile the test us= ing ocamlopt solely, this is not necessary. It seems some buffers do not ge= t flushed here. Does anyone know, why?

regards,

C= hristoph






--94eb2c05ed12659ef9054818784f--