* [Caml-list] Question about linking and module initialization
@ 2002-09-13 18:05 Alessandro Baretta
2002-09-14 9:58 ` Yamagata Yoriyuki
0 siblings, 1 reply; 3+ messages in thread
From: Alessandro Baretta @ 2002-09-13 18:05 UTC (permalink / raw)
To: Ocaml
What is the difference between linking an application with
the following command
$ ocamlc -o app module1.cmo module2.cmo module3.cmo
and
$ ocamlc -a app.cma module1.cmo module2.cmo module3.cmo
$ ocamlc -o app app.cma
.
I have noticed that if I attempt to link an executable in
the latter way, the linking phase succeeds, but the
executable exits immediately with exit status 0 (no error).
This makes me wonder about how modules are initialized when
an executable is launched. How is module initialization
different for modules belonging to library files with
respect to modules coming from .cmo files?
Alex
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Question about linking and module initialization
2002-09-13 18:05 [Caml-list] Question about linking and module initialization Alessandro Baretta
@ 2002-09-14 9:58 ` Yamagata Yoriyuki
2002-09-15 17:34 ` Alessandro Baretta
0 siblings, 1 reply; 3+ messages in thread
From: Yamagata Yoriyuki @ 2002-09-14 9:58 UTC (permalink / raw)
To: caml-list
From: Alessandro Baretta <alex@baretta.com>
Subject: [Caml-list] Question about linking and module initialization
Date: Fri, 13 Sep 2002 20:05:16 +0200
> $ ocamlc -o app app.cma
In this case, modules only used from the main program are linked.
Since you don't provide anything except app.cma, I guess nothing is
linked. Initialization is done by the linking order of modules in
app.cma.
Everything is explained in the ocamlc section of the manual.
--
Yamagata Yoriyuki
http://www.mars.sphere.ne.jp/yoriyuki/
PGP fingerprint = 0374 5290 7445 4C06 D79E AA86 1A91 48CB 2B4E 34CF
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Question about linking and module initialization
2002-09-14 9:58 ` Yamagata Yoriyuki
@ 2002-09-15 17:34 ` Alessandro Baretta
0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Baretta @ 2002-09-15 17:34 UTC (permalink / raw)
To: Yamagata Yoriyuki; +Cc: caml-list
Yamagata Yoriyuki wrote:
>>$ ocamlc -o app app.cma
>
>
> In this case, modules only used from the main program are linked.
> Since you don't provide anything except app.cma, I guess nothing is
> linked.
Ah, this is the point. I did not realize that modules in a
library would be selected at linking time by ocamlc.
> Initialization is done by the linking order of modules in
> app.cma.
This is what I thought, but I did not realize that my
executable would be entirely empty of modules.
> Everything is explained in the ocamlc section of the manual.
I had read it already, but I happened to overlook the fact
that modules in libraries are linked only if referenced
somewhere in the cmo files.
Thank you very much.
Alex
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-15 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13 18:05 [Caml-list] Question about linking and module initialization Alessandro Baretta
2002-09-14 9:58 ` Yamagata Yoriyuki
2002-09-15 17:34 ` Alessandro Baretta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox