English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Cannot access module members as unqualified
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-10-10 (09:30)
From: rouanvd@s...
Subject: Cannot access module members as unqualified
Hi everyone.

I am having trouble getting my modules to work together.

I have 2 modules :

module Preprocessor =

        let run txt =
            print_endline txt;
            txt ^ txt ;;


module Main =

        open Preprocessor;;

        let main () =
            let text = "some text" in
            run text ;;


I want to use the 'run' function unqualified, but i get a compilation

Error: Unbound value run

when I qualify the run function with 'Preprocessor.' it works fine, but I
dont want to qualify the run function.

here are the commands that I use to compile the 2 modules:


#compile the Preprocessor module & move to obj\ dir
ocamlc -c Preprocessor\Preprocessor.ml
move Preprocessor\*.c* build\obj\

#compile the Main module & move to obj\ dir
ocamlc  -I build\obj\ -c Preprocessor.cmo Main.ml
move *.c* build\obj\

#link all object files to form executable
ocamlc -o build\bin\c.exe build\obj\Preprocessor.cmo build\obj\Main.cmo