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