Hello,

I've change the toplevel of Ocaml to replace the standard input and output by named pipes on Windows.

To achieve this, I've change the toploop.ml (https://github.com/ocaml/ocaml/blob/trunk/toplevel/toploop.ml) to include the named pipes
of Ocamlnet (http://projects.camlcity.org/projects/dl/ocamlnet-4.1.2/doc/html-main/Netsys_win32.html#1_Supportfornamedpipes).

After that, I tried to understand how I could compile this custom toplevel.
I want to compile the toplevel to have a .exe, so I could avoid using Cygwin to launch the application.

I've run the makefile of the git repository of Ocaml and tried to follow the sequence of compilation for the toplevel.
I use ocamlopt to have a native aplication and ocamlfind to link toploop.ml with the library ocamlnet
(via the package netsys where the win32 named pipe are defined) and unix for catching exceptions.

I use Opam : 1.3.0~dev, Ocaml : 4.03.0 and Cygwin on Windows 7.

So I write a Makefile (see the attachement) and when I launch it, I get this :
______________________________________________________________________
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c genprintval.mli
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c genprintval.ml
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c toploop.mli
ocamlfind ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c toploop.ml -linkpkg -package netsys -package unix
File "C:\OCaml64\home\Zar\toplevel_custom\_none_", line 1:
Warning 58: no cmx file was found in path for module Netsys_win32, and its interface was not compiled with -opaque
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c trace.mli
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c trace.ml
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topdirs.mli
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topdirs.ml
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topmain.mli
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topmain.ml
ocamlopt -g -I +compiler-libs -a -o tmp_ocamltoplevel.cmxa genprintval.cmx toploop.cmx trace.cmx topdirs.cmx topmain.cmx
ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -c topstart.ml
ocamlfind ocamlopt -g -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa ocamlcommon.a ocamlbytecomp.a -linkall -o toplevel_custom.exe tmp_ocamltoplevel.cmxa topstart.cmx tmp_ocamltoplevel.a -linkpkg -package netsys -package unix
** Cannot resolve symbols for tmp_ocamltoplevel.a(topdirs.o):
caml_get_current_environment
File "caml_startup", line 1:
Error: Error during linking
______________________________________________________________________

But I don't know how to resolve this error.
I find that "caml_get_current_environment" is defined in meta.c (and used in topdirs.ml)
(https://github.com/ocaml/ocaml/search?utf8=%E2%9C%93&q=caml_get_current_environment+&type=)
But I think that meta.c is in the ocamlbytecomp.cmxa library, so I don't know why the linker don't find the symbols.

Someone know how to resolve this problem ?

Thank you in advance !