Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Christoph Höger" <christoph.hoeger@celeraone.com>
To: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Is there some builtin function that flushes buffers on shutdown?
Date: Thu, 9 Feb 2017 13:53:39 +0100	[thread overview]
Message-ID: <CAOazmvtsXpmNAnr2WxY2PLmUF0ZYx34LGjC8uGnD0GEfU8N+_Q@mail.gmail.com> (raw)
In-Reply-To: <CADK7aFPq3oxzbgRREGm6OfBSu3J=8Re93+hhE7ARO8hBixZHJg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2617 bytes --]

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ás Ojeda Bär <
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ás Ojeda Bär <
> 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öger <
>> 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 complained
>>> about a missing symbol, right?
>>>
>>> On Fri, Feb 3, 2017 at 10:16 AM, Nicolás Ojeda Bär <
>>> 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öger <
>>>> 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:
>>>>>
>>>>> ➜  llvmlink ocamlfind opt -package ANSITerminal -linkpkg -verbose
>>>>> -output-obj -o test.object.o test.ml
>>>>>
>>>>> ➜  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 changes, when I manually flush the stdout buffer in the code (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 do not
>>>>> get flushed here. Does anyone know, why?
>>>>>
>>>>> regards,
>>>>>
>>>>> Christoph
>>>>>
>>>>>
>>>>
>>>
>>
>

[-- Attachment #2: Type: text/html, Size: 4966 bytes --]

      reply	other threads:[~2017-02-09 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03  8:56 Christoph Höger
2017-02-03  9:16 ` Nicolás Ojeda Bär
2017-02-03 10:15   ` Christoph Höger
2017-02-03 10:52     ` Nicolás Ojeda Bär
2017-02-03 11:37       ` Nicolás Ojeda Bär
2017-02-09 12:53         ` Christoph Höger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOazmvtsXpmNAnr2WxY2PLmUF0ZYx34LGjC8uGnD0GEfU8N+_Q@mail.gmail.com \
    --to=christoph.hoeger@celeraone.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.ojeda.bar@lexifi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox