From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA27923; Thu, 3 Jun 2004 17:19:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA27911 for ; Thu, 3 Jun 2004 17:19:55 +0200 (MET DST) Received: from mailfe04.swip.net (mailfe04.swip.net [212.247.154.97]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i53FJsSH016413 for ; Thu, 3 Jun 2004 17:19:55 +0200 X-T2-Posting-ID: +Fzxb8ijMtpvZ+oCWeFeV97fN06SrlYKWbc7nsfdk0I= Received: from [80.170.24.236] (HELO piv) by mailfe04.swip.net (CommuniGate Pro SMTP 4.2b4a) with SMTP id 56496828; Thu, 03 Jun 2004 17:19:54 +0200 Received: by piv (sSMTP sendmail emulation); Thu, 3 Jun 2004 17:19:53 +0200 Date: Thu, 3 Jun 2004 17:19:53 +0200 From: James Scott To: Caml List Subject: [Caml-list] dynlink and toplevel Message-ID: <20040603151953.GE1562@piv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-Miltered: at concorde with ID 40BF419A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; runbox:99 dynlink:01 dynlink:01 snag:01 helper:01 loadfile:01 helper:01 ocamlc:01 ocamlc:01 ocamlmktop:01 3.07:01 cmo:01 cmo:01 semantics:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi All, we're doing some work where it's useful to use Dynlink in the toplevel, but we've run into a snag: if the Dynlink-loaded module refers to modules loaded by '#load' or on the command line, they're not resolved. But if they're put into a 'custom' toplevel they are, e.g. $ cat Loader.ml let dynload_helper_ref = ref (None: int option) let doit fname = let _ = Dynlink.init () in let _ = Dynlink.loadfile fname in !dynload_helper_ref $ cat Loadee.ml Loader.dynload_helper_ref := Some 1 $ cat Test.ml let _ = Loader.doit "Loadee.cmo" ;; $ ocamlc -c Loadee.ml $ ocamlc -a -o llib.cma Loader.ml $ ocaml dynlink.cma llib.cma Test.ml Exception: Dynlink.Error (Dynlink.Linking_error ("Loadee.cmo", Dynlink.Undefined_global "Loader")). But this works: $ ocamlmktop dynlink.cma llib.cma $ ./a.out < Test.ml Objective Caml version 3.07+2 # - : int option = Some 1 This was a bit of a surprise as I was expecting the two load semantics to be identical... but is there any way round it? James ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners