On 03/22/2012 05:42 PM, Richard W.M. Jones wrote:
> On Thu, Mar 22, 2012 at 01:51:57PM +0100, Alain Frisch wrote:
>> On 03/22/2012 12:47 PM, Richard W.M. Jones wrote:
>>> I'm a bit surprised to find that native dynlink doesn't work in the
>>> same way as bytecode dynlink in respect to reloading the same module.
>>> (See attached test program)
>>>
>>> In bytecode dynlink, reloading (ie. Dynlink.loadfile) the same module
>>> causes the new module code to override the old module code:
>>>
>>>   $ ./dynlink_test
>>>   testing bytecode ...
>>>   a
>>>   b
>>>
>>> But in native dynlink, the new module is silently discarded and the
>>> old code appears to run:
>>>
>>>   $ ./dynlink_test
>>>   testing native ...
>>>   a
>>>   a
>>>
>>> I would classify this as a bug, but I'm not quite sure what is
>>> expected to happen.  Is there some other way to override a module as
>>> in bytecode?
>> natdynlink currenlty depends on the OS dynamic linker, we cannot
>> control the semantics so precisely (you can try loadfile_private,
>> but I'm not sure it would solve your issue).
> This is all a bit, umm, unexpected.
>
> Stepping back, the problem I'm trying to solve is how to reload a
> configuration-like file into a daemon without restarting the daemon.
> The "configuration-like file" is the whenjobs jobs script[1], and the
> daemon is the whenjobs daemon[2].
>
> Any ideas on how best to go about this?  Note that the whenjobs jobs
> script is intentionally a Turing-complete OCaml program, so converting
> it to another format is probably not going to be practical.
>
I did not really read your code, but it seams to me that you are doing
the compilation in your tool.
So you can choose the name of the module. Isn't it possible to change
the name of the file each
time you compile/reload it ?
-- 
Pierre

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to