Hello,

I've been working on this https://github.com/mattgray/horseos as a means of
learning about OCaml and the Mirage project. It's a super-basic chat
program that works over TCP. Like IRC with almost no features.

I've got it all working so far by defining everything in unikernel.ml, and
now I'm trying to split things out into modules - specifically a session
module which deals with reading and writing strings to the TCP connection.
This module works OK when it's also defined in unikernel.ml (see: eg
https://github.com/mattgray/horseos/blob/2563d75b59d95f4a69937cee690f6c8c53a6e79b/unikernel.ml
)

However when I pull the module out into it's own file entirely like this: (
https://github.com/mattgray/horseos/blob/4e7e419ee06e8e245ef466bfa5e9fca546746871/session.ml
) I get build errors from make (after doing mirage clean/configure):

ocamlbuild -classic-display -use-ocamlfind -pkgs
lwt.syntax,mirage-console.unix,mirage-types.lwt,tcpip.stack-socket -tags
"syntax(camlp4o),annot,bin_annot,strict_sequence,principal" -tag-line
"<static*.*>: -syntax(camlp4o)" -cflag -g -lflags -g,-linkpkg main.native
ocamlfind ocamlc -c -g -annot -bin-annot -principal -strict-sequence
-package tcpip.stack-socket -package mirage-types.lwt -package
mirage-console.unix -package lwt.syntax -syntax camlp4o -o session.cmo
session.ml
+ ocamlfind ocamlc -c -g -annot -bin-annot -principal -strict-sequence
-package tcpip.stack-socket -package mirage-types.lwt -package
mirage-console.unix -package lwt.syntax -syntax camlp4o -o session.cmo
session.ml
File "session.ml", line 3, characters 17-35:
*Error: Unbound module STACKV4*

I'm not sure how to make the STACKV4 (or ultimately the TCPV4.flow type
which is what I really need) into scope here. It seems like
mirage-types.lwt is being passed as a package into ocamlbuild, and I have
tried various permutations on open-ing V1, V1_LWT, V1_LWT.STACKV4 to no
avail. The other thing I have considered (but not tried yet) is that the
session module needs to be "functorized" to work with the types from Mirage.

Any pointers here would be most appreciated.... I feel like there's
something simple / fundamental here that I'm completely missing!

Matt
_______________________________________________
MirageOS-devel mailing list
[email protected]
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

Reply via email to