Using "ocamlfind" to make the OCaml compiler and toplevel find (project specific) libraries

Posted by CharlieP on Stack Overflow See other posts from Stack Overflow or by CharlieP
Published on 2010-01-07T19:48:55Z Indexed on 2010/05/23 19:11 UTC
Read the original article Hit count: 303

Filed under:
|
|

Hello,

I'm trying to use ocamlfind with both the OCaml compiler and toplevel. From what I understood, I need to place the required libraries in the _tags file at the root of my project, so that the ocamlfind tool will take care of loading them - allowing me to open them in my modules like so :

open Sdl
open Sdlvideo
open Str

Currently, my _tags file looks like this :

<*>: pkg_sdl,pkg_str

I can apparently launch the ocamlfind command with the ocamlc or ocamlopt argument, provided I wan't to compile my project, but I did not see an option to launch the toplevel in the same manner. Is there any way to do this (something like "ocamlfind ocaml")?

I also don't know how to place my project specific modules in the _tags file : imagine I have a module name Land. I am currently using the #use "land.ml" directive to open the file and load the module, but it has been suggested that this is not good practice. What syntax should I use in _tags to specify it should be loaded by ocamlfind (considering land.ml is not in the ocamlfind search path) ?

Thank you, Charlie P.

Edit : According to the first answer of this post, the _tags file is not to be used with ocamlfind. The questions above still stand, there is just a new one to the list : what is the correct way to specify the libraries to ocamlfind ?

© Stack Overflow or respective owner

Related posts about ocaml

Related posts about ocamlbuild