English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
How can I convince ocamlbuild to link a library instead of object files?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-21 (12:54)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] How can I convince ocamlbuild to link a library instead of object files?
Excerpts from alan.falloon's message of Wed Oct 17 17:10:21 +0200 2007:
> I am working on a project in ocaml that has a number of libraries that 
> it depends on that are being concurrently developed.
> I can easily set up ocamlbuild to build the binaries and the libraries, 
> however the binaries are always built from the object files that are 
> packed into the library even if I tell it to link in the library via a 
> plugin.
> I have attached an interactive script (lightly edited for clarity). The 
> thing to notice is that when it links main.byte it still includes 
> hello.cmo and world.cmo even though they are in hw.cma. This works for 
> the bytecode linking, but its a disaster for native code.
> Is there some way to remove the object files from the link line in the 
> plugin? or am I missing some trick? It doesn't matter if the library 
> sources are in a different directory, if its included (and it has to be 
> included or ocamlbuild won't build the lib) then ocamlbuild will find 
> the object files and use them.

(Sorry for the late reply)

Can you try to declare the library using the ocaml_lib function.

Something  like  <<ocaml_lib "hw">>  in  your  myocamlbuild.ml, otherwise the
use_hw tag is not used.

Nicolas Pouillard aka Ertai