Version franaise
Home About Download Resources Contact us
Browse thread
Dynamic loading of native code : what about librairies and packs ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] Dynamic loading of native code : what about librairies and packs ?
On Tue, 1 Sep 2009 10:56:47 +0200, Pierre-Loïc Garoche wrote:
> 
> Question: How should I link it to rely on external libraries and
> produce a valid MyPlugin.cmxs ?

You should reference « Hashtbl » in your main program :

> main.ml:
  module ForLinking_1 = Hashtbl
  let () = print_string "main\n"
  let () = Dynlink.loadfile "MyPlugin.cmxs"

BTW, if you want your program to work in both bytecode and native
code, you should use:

  Dynlink.loadfile (Dynlink.adapt_filename "MyPlugin.cmo")

Cheers,
C.