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
Tutorial example for nat dynlink
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-26 (14:34)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Tutorial example for nat dynlink
Hello Yves,

> I have been trying to build a small example "hello world" program
> using native dynlink, but I don't manage to make it work.  Could
> please send me some advice?

The issue here is that when Dynlink.loadfile is called, module Toto is
not yet completely evaluated, therefore it is not yet visible to
dynamically-loaded code.  The solution is just to split your main
program in two modules: Toto containing what your plugin needs to see,
and Totomain performing the dynlink.  Then, it'll work just fine.


- Xavier