Problems with "Example: A Terminal Interface"

http://dev.realworldocaml.org/foreign-function-interface.html

$ dune build hello.exe
Entering directory ‘/Users/joel/src/book’
Don’t know how to build examples/code/ffi/hello/hello.exe

In hello.ml, I wonder how the “open Ncurses” is supposed to work, since there is no such library installed in the instructions. When trying to manually load it in utop it fails:

utop # open Ncurses;;
Error: Unbound module Ncurses

To me it looks like the C bindings (done with Ctypes) are in a file ncurses.ml which would constitute this module. What is is in which file is not so obvious.

There is a ncurses.ml file which is a symlink to …/ncurses/ncurses.ml

There are no instructions though on how to build Ncurses,
I tried this but doesn’t seem to work:

cd ../ncurses/ dune build ncurses.exe
Entering directory ‘/Users/joel/src/book’
Don’t know how to build examples/code/ffi/ncurses/ncurses.exe

This is the dune file for ncurses:
$ cat dune
(executable
(name ncurses)
(libraries ctypes.foreign))

Maybe the instructions on how to build and use the Ncurses library is missing from the instructions in the book?

CC’ing @avsm and @samoht. I think one thing that made this better in previous editions of RWO is that the filename was marked in code examples in the HTML and book output. Maybe this is something we can try to recover in the dev version of the book.

y

The command from v1 works fine:

$ corebuild -pkg ctypes.foreign -lflags -cclib,-lncurses hello.native 

However using dune as suggested in the dev version doesn’t work:

dune build hello.exe

I also tried dune build hello.native but doesn’t work.

Want me to edit the instructions in dev to use corebuild instead and send a PR?
Or is there a way to build it using dune?