[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ocamlsdl, exceptions not registered



Le 18/06/2012 21:21, Florent Monnier a écrit :
>>> Even if it's an ocaml bug, don't you think that we should try to do
>>> something? [...]
>>> Please tell-me what you think.
>>
>> I don't consider this a bug, merely an unfortunate (and "well known" :)
>> behaviour.
>>
>> IMHO, the proper fix is to put the calls to Callback.register_exception
>> (and other initialization stuff) in a module that is not included in a
>> .cma/.cmxa (for example, sdlInit.{cmo,cmx}, like in lablgtk2). Another
>> workaround is to use the -linkall option.
> 
> For the sdlInit solution, would you make as many sdlMyModInit files that there 
> are modules ?

One per archive. The linker always links individual modules that are
given on the command line (which is what you want for side-effects), but
links only used modules for archives (.cma/.cmxa), unless -linkall is
given. Thanks to findlib, the additional module is no burden to the user.

I forgot to mention the obvious fix: leave externals abstract in .mli
files (i.e. put "val" instead of "external"). My guess is that it will
have a small impact in bytecode, but not in native code if .cmx are kept.


Cheers,

-- 
Stéphane


Reply to: