* [Caml-list] Unused .cma and .so
@ 2002-04-15 17:21 Claudio Sacerdoti Coen
2002-04-15 17:49 ` Warp
2002-04-26 8:16 ` Xavier Leroy
0 siblings, 2 replies; 5+ messages in thread
From: Claudio Sacerdoti Coen @ 2002-04-15 17:21 UTC (permalink / raw)
To: OCAML
Hi OCamlers,
I used to think that linking a .cma when no module inside it is required
is completely hurtless. I was wrong: it seems that .so added during linking
of those .cma are loaded. To me, this seems a feature with a
counter-intuitive semantics.
Is there any way to disable this behaviour?
Thanks in advance,
C.S.C.
--
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://caristudenti.cs.unibo.it/~sacerdot
----------------------------------------------------------------
-------------------
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] 5+ messages in thread
* Re: [Caml-list] Unused .cma and .so
2002-04-15 17:21 [Caml-list] Unused .cma and .so Claudio Sacerdoti Coen
@ 2002-04-15 17:49 ` Warp
2002-04-16 7:49 ` Claudio Sacerdoti Coen
2002-04-26 8:16 ` Xavier Leroy
1 sibling, 1 reply; 5+ messages in thread
From: Warp @ 2002-04-15 17:49 UTC (permalink / raw)
To: OCaml
> I used to think that linking a .cma when no module inside it is required
> is completely hurtless. I was wrong: it seems that .so added during
linking
> of those .cma are loaded. To me, this seems a feature with a
> counter-intuitive semantics.
>
> Is there any way to disable this behaviour?
You have to link your binary using the -noautolink ocamlc parameter.
( Watch the ocaml manual )
Nicolas Cannasse
-------------------
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] 5+ messages in thread
* Re: [Caml-list] Unused .cma and .so
2002-04-15 17:49 ` Warp
@ 2002-04-16 7:49 ` Claudio Sacerdoti Coen
0 siblings, 0 replies; 5+ messages in thread
From: Claudio Sacerdoti Coen @ 2002-04-16 7:49 UTC (permalink / raw)
To: Warp; +Cc: OCaml
> You have to link your binary using the -noautolink ocamlc parameter.
> ( Watch the ocaml manual )
I already knew that parameter, but it is not what I would like to have.
Here comes the problem with more informations: when using findlib with
libraries providing more than one .cma (e.g. lablgtk), I expect
findlib to add to the linking phase every .cma and ocamlc to not consider
all the unuseful ones. Since ocamlc still considers the linking options of
the .cma, I can't no more use findlib in that way and I have to add
O(2^n) rules to the META file to choose exactly which .cma to add.
If I use the -noautolink option, instead, it effects every .cma
(even the ones belonging to other packages) and I have to add many many
linking options by hand (and so why should I use findlib or something
similar at all?)
I hope to have been more clear.
Regards,
C.S.C.
--
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://caristudenti.cs.unibo.it/~sacerdot
----------------------------------------------------------------
-------------------
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] 5+ messages in thread
* Re: [Caml-list] Unused .cma and .so
2002-04-15 17:21 [Caml-list] Unused .cma and .so Claudio Sacerdoti Coen
2002-04-15 17:49 ` Warp
@ 2002-04-26 8:16 ` Xavier Leroy
2002-04-26 10:57 ` Claudio Sacerdoti Coen
1 sibling, 1 reply; 5+ messages in thread
From: Xavier Leroy @ 2002-04-26 8:16 UTC (permalink / raw)
To: Claudio Sacerdoti Coen; +Cc: OCAML
> I used to think that linking a .cma when no module inside it is required
> is completely hurtless. I was wrong: it seems that .so added during linking
> of those .cma are loaded. To me, this seems a feature with a
> counter-intuitive semantics.
> Is there any way to disable this behaviour?
No, because it is actually necessary.
External functions declared in .mli files are expanded inline into
client code. For instance, if we have a module A with signature
external f : ... = "my_f"
val g : ...
references to A.f in client code are expanded inline into C calls to "my_f",
while references to A.g leave an explicit reference to A in client code.
Now, assume that we have a.cma composed of the module A above and of
a C library dlla.so defining my_f. If the client code never references A.g,
the linker will correctly discard the Caml code for A. However, it
must link dlla.so so that inlined references to "my_f" are satisfied.
If you're linking with ocamlopt or ocamlc -custom, the C linker will
be passed liba.a and will actually discard it if there are no
references to my_f. But doing the same thing with the pure bytecode
compiler ocamlc is very hard: there is no standard API to examine
the dependencies of DLLs, and the C part of a library can reference
directly functions form the C part of another library.
- Xavier Leroy
-------------------
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] 5+ messages in thread
end of thread, other threads:[~2002-04-26 10:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-15 17:21 [Caml-list] Unused .cma and .so Claudio Sacerdoti Coen
2002-04-15 17:49 ` Warp
2002-04-16 7:49 ` Claudio Sacerdoti Coen
2002-04-26 8:16 ` Xavier Leroy
2002-04-26 10:57 ` Claudio Sacerdoti Coen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox