Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dynlink problems
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Dynlink problems
From: Richard Jones <rich@annexia.org>

> So far I get strange errors like:
> 
> Syntax error on line 84 of /home/rich/d/merjis/test/mod_caml/test/httpd.conf:
> error while linking /home/rich/d/merjis/test/mod_caml/eg_print_trans.cma.
> Reference to undefined global `Callback'
> 
> I can fix that one by added stdlib.cma to the list of libraries linked
> into eg_print_trans.cma, but that seems the wrong thing to do.

Indeed, this is not the best way to do that. What you should is export
the corresponding units to dynlink modules. From the documentation:

val add_interfaces : string list -> string list -> unit
(** [add_interfaces units path] grants dynamically-linked object
   files access to the compilation  units named in list [units].
   The interfaces ([.cmi] files) for these units are searched in
   [path] (a list of directory names). Initially, dynamically-linked
   object files do not have access to any of the compilation
   units composing the running program, not even the standard library.
   [add_interfaces] or {!Dynlink.add_available_units} (see below) must be
   called to grant access to some of the units. *)

Actually [add_available_units] is probably better.

> Even when I do this, I get:
> 
> Syntax error on line 84 of /home/rich/d/merjis/test/mod_caml/test/httpd.conf:
> error while linking /home/rich/d/merjis/test/mod_caml/eg_print_trans.cma.
> The external function `caml_input' is not available
> 
> .. which I haven't been able to fix because -lcamlrun is only available
> as a static library (why??).

If you dynamically link modules with external definitions, you must
also call [allow_unsafe_modules]!

Jacques Garrigue

-------------------
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