exception not registered.Abandon
Searching Google I don't find anything about this error message.
How should I interpret it?
--
Thanks
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Is the program linked to C code (apart from stdlib, I mean)?
AFAICT, no part of that message occurs in the OCaml codebase, although
my checked out version is a few months old now.
Rich.
--
Richard Jones
Red Hat
Yes it is.
It's linked with OpenGL (only the GL lib, no GLU or anything esle) and SDL
(through ocaml-sdl)
It's a program that I try to switch the windowing part from Glut to SDL.
With Glut it works alright.
Also I've just seen that running in the interpreted mode instead of native
code the program does run without any problem.
Do these additional informations give you any clue?
--
Thanks
As Adrian said, it's from ocaml-SDL. It's from one of several
functions which look like this:
static void
sdlloader_raise_exception (char *msg)
{
static value *loader_exn = NULL;
if(! loader_exn){
loader_exn = caml_named_value("SDLloader_exception");
if(! loader_exn) {
fprintf(stderr, "exception not registered.");
abort();
}
}
raise_with_string(*loader_exn, msg);
}
Essentially you have to register OCaml exceptions before you can call
them from C, so it sounds like you're not calling some sort of SDL
"init" function (or calling it too late in your program). Or possibly
there is a bug in the ocaml-SDL bindings.
Rich.
--
Richard Jones
Red Hat
_______________________________________________
For example, is 'sdlloader.cmxa' linked into your program? There are
others that might have to be linked in too -- see the META file or
just use ocamlfind.
In the source of the sdlvideo.ml module there is:
exception Video_exn of string
let _ =
Callback.register_exception "SDLvideo2_exception" (Video_exn "")
it seems for some reason that this code is not executed, because if I add at
the beginning of my program (not in sdl source):
let () =
(* notice the exception is prefixed with the name of the sdl module *)
Callback.register_exception "SDLvideo2_exception" (Sdlvideo.Video_exn "");
;;
then I get the correct exception.
I don't understand what the bug is.
It's (I think) the usual problem with library bindings where the
functions in the .mli are externals.
When your code contains only calls to externals of the module
(Sdlvideo), only the C part is linked in and not caml part (the .cmo).
The problem is that the important Callback.register_exception call is
in the caml part.
Solution: reference somewhere in your code a function that's declared
as "val" in the sdlvideo.mli.
cf. http://caml.inria.fr/mantis/view.php?id=4166 for instance
--
Olivier