From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA27728 for caml-redistribution; Thu, 5 Nov 1998 08:44:44 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA17592 for ; Wed, 4 Nov 1998 17:11:50 +0100 (MET) Received: from maxime.u-strasbg.fr (maxime.u-strasbg.fr [130.79.75.36]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id RAA07837 for ; Wed, 4 Nov 1998 17:11:46 +0100 (MET) From: luther@maxime.u-strasbg.fr Received: (from luther@localhost) by maxime.u-strasbg.fr (8.8.7/8.8.7) id RAA19572 for caml-list@inria.fr; Wed, 4 Nov 1998 17:12:53 +0100 (MET) Message-ID: <19981104171253.A19346@maxime.u-strasbg.fr> Date: Wed, 4 Nov 1998 17:12:53 +0100 To: caml-list@inria.fr Subject: Re: problem with ocamlmktop -output-obj Reply-To: luther@dpt-info.u-strasbg.fr References: <3624D5BE.3060@dassault-aviation.fr> <19981015192243.14795@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <19981015192243.14795@pauillac.inria.fr>; from Xavier Leroy on Thu, Oct 15, 1998 at 07:22:43PM +0200 Sender: weis On Thu, Oct 15, 1998 at 07:22:43PM +0200, Xavier Leroy wrote: > > I have encountered a problem while trying to build a toplevel > > (ocamlmktop) linked with > > - external C code and > > - ML code compiled as a C object (-output-obj and implicitely -custom). > > I have no problem when I build an ordinary batch (non-toplevel) program. > > Is this a limitation of the system or I am doing it wrong ? > > Toplevels need access to their own symbol table, and they look inside > their executable file to find it. The symbol table information is not > available if -output-obj is selected. > > A regular bytecode executable file is composed of several sections: > code, data, symbols, and debug info. Currently, only the first two > are available when a C object is generated instead of a regular > executable file. > > For the same reasons, you can't debug a Caml program built with > -output-obj. Je pense que j'ai un probleme similaire. I think i have a similar problem. Je veut utiliser plus d'un source ocaml embarque dans du C. i want to use more than one ocaml source file embedded in C. donc je prend l'exemple de la doc, j'ajoute un other.ml contenant : so i take the example, and add an other.ml file containing : let my_format_result n = Printf.sprintf "Result is: %d\n" n et modifie mod.ml comme suit : and modify mod.ml as follows : (* File mod.ml -- some ``useful'' Caml functions *) let rec fib n = if n < 2 then 1 else fib(n-1) + fib(n-2) let format_result n = Other.my_format_result n (* Export those two functions to C *) let _ = Callback.register "fib" fib let _ = Callback.register "format_result" format_result et a la compilation j'ai le probleme suivant : and when compiling i have the following error : ocamlc -custom -output-obj -o other.o other.ml ocamlc -custom -output-obj -o modcaml.o modcaml.ml Error while linking modcaml.cmo: Reference to undefined global `Other' Est-il possible de compiler plusieurs source ocaml, en une librairie .cma par exemple, puis de faire un -output-obj de celle-ci ? Est ce que cela resoudrait le probleme ? Ou alors dois-je creer un fichier source geant, et transformer mon other.ml en module Other = struct (contenu de other.ml) end, eventuellement automatiquement ? Pas tres joli, mais cela marche. IS it possible to compile more than 1 caml source, as a .cma library for example, and then embedd it in C code ? will this solve my problem, or should i do alone giant caml source file that include all other source files as modules ? Amicalement, Sven LUTHER