From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 9C8B2BC57 for ; Mon, 15 Mar 2010 10:13:04 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkUDAIKWnUvRVdrYkGdsb2JhbACSeYduCBUBAQEBCQkMBxMDH4ghoDyDeYh5AQEDBYR2BIwm X-IronPort-AV: E=Sophos;i="4.49,641,1262559600"; d="scan'208";a="46875524" Received: from mail-bw0-f216.google.com ([209.85.218.216]) by mail3-smtp-sop.national.inria.fr with ESMTP; 15 Mar 2010 10:13:03 +0100 Received: by bwz8 with SMTP id 8so2710848bwz.3 for ; Mon, 15 Mar 2010 02:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=ExBqK4uZJawEMBXw3Hk9OKiQOt2IKYwiIhJG+ZQfVXk=; b=kdudFQ0FuL6RX3SR5v6druVmyzdB0Ac22BzkhnioxQH9irU/hSOybRb2HhMSUU9+9n phENGG8EWifk8JSM/ta6ZYSq44Am/9zERb6UTb7rd7SGMcrtgHFCJwedZrVAa4iNsmip MNGQUfL5hUOG6Thl5Oeywp0dJPSYfH8b/SnM8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=UCdSfFh8zDGz4frHkxXB9zn1duuZNjBI+ilU0jLkNlcfL9ebrdG/aabCbzDGjoKhvb 7iEj5adl4OCz/KqDYwS2gh3fVsLQRxAVyj9zaUlYfHKtBIqcvQzU+EViog7ClQN7P1HO YNMywuuA9VvZCihRIU9ugVz5hnBrxI+GH0a04= MIME-Version: 1.0 Sender: oandrieu@gmail.com Received: by 10.204.25.130 with SMTP id z2mr2117974bkb.211.1268644383162; Mon, 15 Mar 2010 02:13:03 -0700 (PDT) In-Reply-To: <201003132033.33849.monnier.florent@gmail.com> References: <201003131742.25933.monnier.florent@gmail.com> <201003131936.16333.monnier.florent@gmail.com> <20100313185537.GA27381@annexia.org> <201003132033.33849.monnier.florent@gmail.com> Date: Mon, 15 Mar 2010 10:13:03 +0100 X-Google-Sender-Auth: 012d05c8e9a6fd37 Message-ID: <95513601003150213q36a5435at93bf7c8a45549241@mail.gmail.com> Subject: Re: [Caml-list] exception not registered.Abandon From: Olivier Andrieu To: Florent Monnier Cc: caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; andrieu:01 oandrieu:01 0100,:01 compiler:01 stdlib:01 lib:01 windowing:01 exn:01 exn:01 fprintf:01 stderr:01 ocaml:01 bug:01 bindings:01 sdlvideo:01 On Sat, Mar 13, 2010 at 20:33, Florent Monnier wrote: > Le samedi 13 mars 2010 19:55:37, vous avez =E9crit : >> On Sat, Mar 13, 2010 at 07:36:16PM +0100, Florent Monnier wrote: >> > > > I have compiled a program using the native compiler, then when I r= un >> > > > the executable I get this error message: >> > > > >> > > > exception not registered.Abandon >> > > > >> > > > Searching Google I don't find anything about this error message. >> > > > How should I interpret it? >> > > >> > > Is the program linked to C code (apart from stdlib, I mean)? >> > >> > 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 SD= L. >> > 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? >> >> As Adrian said, it's from ocaml-SDL. =A0It's from one of several >> functions which look like this: >> >> =A0static void >> =A0sdlloader_raise_exception (char *msg) >> =A0{ >> =A0 =A0static value *loader_exn =3D NULL; >> =A0 =A0if(! loader_exn){ >> =A0 =A0 =A0loader_exn =3D caml_named_value("SDLloader_exception"); >> =A0 =A0 =A0if(! loader_exn) { >> =A0 =A0 =A0 =A0fprintf(stderr, "exception not registered."); >> =A0 =A0 =A0 =A0abort(); >> =A0 =A0 =A0} >> =A0 =A0} >> =A0 =A0raise_with_string(*loader_exn, msg); >> =A0} >> >> 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). =A0Or possibly >> there is a bug in the ocaml-SDL bindings. > > In the source of the sdlvideo.ml module there is: > > exception Video_exn of string > let _ =3D > =A0Callback.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 () =3D > =A0(* notice the exception is prefixed with the name of the sdl module *) > =A0Callback.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=3D4166 for instance --=20 Olivier