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 >> >> >