caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Forced linking and Ocamlbuild
@ 2010-04-05 15:08 Dario Teixeira
  2010-04-05 15:41 ` [Caml-list] " Daniel Bünzli
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Teixeira @ 2010-04-05 15:08 UTC (permalink / raw)
  To: caml-list

Hi,

I'm using Ocamlbuild with the findlib plugin listed on the Wiki.
In this setting, how does one force a given module to always be
linked into the final executable, even if it's not referenced
anywhere?  (I realise there's always the option of adding a
dummy reference, but I'm looking for a cleaner solution).

Note that the package is of course listed under "true" in the
top-level _tags file, but it's being pruned out from the actual
invocation of ocamlfind.  Normally this is a sensible approach,
but in this case I want to force linking.  Also, I've searched
into the (long) list of built-in tags, but couldn't find anything
resembling this purpose.

While I can of course explicitly change the myocamlbuild plugin
so that invocations of the compiler always append the module I
want to link, I wonder if there's not already a cleaner, more
general solution that I may have missed.

Thanks in advance!
Best regards,
Dario Teixeira






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Forced linking and Ocamlbuild
  2010-04-05 15:08 Forced linking and Ocamlbuild Dario Teixeira
@ 2010-04-05 15:41 ` Daniel Bünzli
  2010-04-05 16:02   ` Dario Teixeira
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Bünzli @ 2010-04-05 15:41 UTC (permalink / raw)
  To: Dario Teixeira; +Cc: caml-list

> (I realise there's always the option of adding a
> dummy reference, but I'm looking for a cleaner solution).

Is it really "unclean" ?

Suppose you'd like to use ocamldoc to output a dot file to understand
the dependencies of your program, if you manage to achieve what you
want to do you'll miss that dependency.

The more info there is in the source (vs. the build procedure) the
easier it is to understand the program.

Best,

Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Forced linking and Ocamlbuild
  2010-04-05 15:41 ` [Caml-list] " Daniel Bünzli
@ 2010-04-05 16:02   ` Dario Teixeira
  0 siblings, 0 replies; 3+ messages in thread
From: Dario Teixeira @ 2010-04-05 16:02 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: caml-list

Hi,

> Suppose you'd like to use ocamldoc to output a dot file to understand
> the dependencies of your program, if you manage to achieve what you
> want to do you'll miss that dependency.
> 
> The more info there is in the source (vs. the build procedure) the
> easier it is to understand the program.

In general I would agree, but in this particular instance the extra
module is just a plugin which registers itself with the main module
via a callback.  It's entirely optional and not a dependence of the
main program -- hence why an automated build system thinks it may
be safely discarded.

Cheers,
Dario Teixeira






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-05 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-05 15:08 Forced linking and Ocamlbuild Dario Teixeira
2010-04-05 15:41 ` [Caml-list] " Daniel Bünzli
2010-04-05 16:02   ` Dario Teixeira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).