From: luther@maxime.u-strasbg.fr
To: caml-list@inria.fr
Subject: Re: problem with ocamlmktop -output-obj
Date: Wed, 4 Nov 1998 17:12:53 +0100 [thread overview]
Message-ID: <19981104171253.A19346@maxime.u-strasbg.fr> (raw)
In-Reply-To: <19981015192243.14795@pauillac.inria.fr>; from Xavier Leroy on Thu, Oct 15, 1998 at 07:22:43PM +0200
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
prev parent reply other threads:[~1998-11-05 7:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-14 16:47 Thierry Bravier
1998-10-15 17:22 ` Xavier Leroy
1998-10-16 10:40 ` Thierry Bravier
1998-10-26 16:03 ` Thierry Bravier
1998-10-30 10:17 ` Pascal Brisset
1998-10-30 17:56 ` problem with ocamlmktop (contd) Pascal Brisset
1998-11-03 9:32 ` Pascal Brisset
1998-11-04 17:56 ` Thierry Bravier
1998-11-04 16:12 ` luther [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19981104171253.A19346@maxime.u-strasbg.fr \
--to=luther@maxime.u-strasbg.fr \
--cc=caml-list@inria.fr \
--cc=luther@dpt-info.u-strasbg.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox