From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id B3DD5BBAF for ; Fri, 8 Aug 2008 01:23:32 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8AADAhm0hIDtyalGdsb2JhbACRAD4BAQEBCQMKBxEDlTWFWg X-IronPort-AV: E=Sophos;i="4.31,323,1215381600"; d="scan'208";a="28037029" Received: from fg-out-1718.google.com ([72.14.220.154]) by mail4-smtp-sop.national.inria.fr with ESMTP; 08 Aug 2008 01:23:02 +0200 Received: by fg-out-1718.google.com with SMTP id l27so593311fgb.43 for ; Thu, 07 Aug 2008 16:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=aIfj6XDnHojbCuffRYZ39J4DjSp/Ofr7Z+wXnAQUwxA=; b=IUBUUuaLEh/AgwF746YtjBD+8swx+fPUfgcgCjsB5ix/T/Bhs1ZEh6ZlVbT80OjdNm tjUGEfAxUeYVgm21fMsT49ba3gJucwFJKIxMfEYgoY3zIlGc1X7ESJ8+wXWdmReRdFWF l86oHDeWAwt41j/Jw+bRIrQ6YzVzsckIVSrFU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=jIq6FfJsRYsRpu+I8CXxPO7hJtTIDoAKziW75jrDHwbpCIHUL9OglHq6bLWXDN4n1W LzXb4AtTYvuBFW0ccThnYytmrMVju2C+EMEbZU4epD12A6UPHE8nfM7B/9hJYE15b/4i Lj+LLZFjnWqAMWawuPJfU2IjHg8fmkG2InWsA= Received: by 10.187.208.18 with SMTP id k18mr158746faq.33.1218151381390; Thu, 07 Aug 2008 16:23:01 -0700 (PDT) Received: by 10.187.207.14 with HTTP; Thu, 7 Aug 2008 16:23:01 -0700 (PDT) Message-ID: Date: Thu, 7 Aug 2008 16:23:01 -0700 From: "Jake Donham" Sender: jake.donham@gmail.com To: caml-list@yquem.inria.fr Subject: linking the same module more than once MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: a54a5b37d26fa2df X-Spam: no; 0.00; ocamlc:01 mkdir:01 ocamlopt:01 ocamlc:01 unix:01 unix:01 exception:01 exception:01 exceptions:01 exceptions:01 cma:01 cma:01 callback:02 caml:02 caml:02 Hi, Consider the following code: a.ml: let a () = raise (Unix.Unix_error (Unix.E2BIG, "", "")) b.ml: try A.a () with Unix.Unix_error (_,_,_) -> () compiled with ocamlc -o test unix.cma a.ml unix.cma b.ml Run it: > ./test Fatal error: exception Unix.Unix_error(0, "", "") With exceptions raised from C code this can even happen within the same module: a.ml: let a () = try Unix.mkdir "/tmp" 0o777 with Unix.Unix_error (_,_,_) -> () b.ml: A.a () There is no trouble linking a module more than once, but different parts of the code can wind up linked to different instances of the module, leading to the confusing behavior that exception handling seems not to work (and generally that things you think are equal are not). For exceptions raised from C code, since Callback.register_exception is called twice, the C code has a different instance from the ML code. Ocamlopt catches multiple definitions; seems like ocamlc should also. But I see bugs http://caml.inria.fr/mantis/view.php?id=1522 http://caml.inria.fr/mantis/view.php?id=1657 suggesting that this is expected behavior. Is there some use for it? (I ran into this trying to use the ocaml-ssl module, which for some reason builds unix.cma into ssl.cma.) Jake