Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2009-03-31 (16:24)
From: Pierre-Loïc_Garoche <Pierre-Loic.Garoche@o...>
Subject: Dynamic loading of native code : what about librairies and packs ?
I am discovering this feature of loading dynamically native code. The
Frama-C framework ( provides now a plugin
architecture that allows you to develop your own plugin and loads it
directly in the framework.

I targeted to adapt a simple tool I developped as a Frama-C plugin and
faced some difficulties. I did not found enough information about the
compilation of cmxs files.

** First: what about external libraries ?
Could you detail the behavior of the linking process of cmxs file with
respect to dependancies.

If I understand well any library used to compile cmx files should be
- either know by the software dynamically loading the plugin,
- or its cmxa should be passed as argument of ocamlopt -shared command.

But what is the difference between:
   ocamlopt.opt -shared  mylib.cmxa xxx.cmx yyy.cmx -o target.cmxs
   ocamlopt.opt -shared -linkall mylib.cmxa xxx.cmx yyy.cmx -o target.cmxs

Both seems to work similarly on my example (no differences between
resulting files).

** Second: how about packs ?
Does the option "-shared -o target.cmxs" is similar to "-pack -o
target.cmx", without the dynamic loading thing ? And what if the plugin
components (cmx files) are or are not compiled with the "-for-pack" option ?

Any information would be greatly appreciated.

Best regards,

Pierre-Loïc Garoche