Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] C++ Throws
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-08-28 (07:45)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] C++ Throws
David Brown wrote:

>On Fri, Aug 27, 2004 at 09:13:52PM -0700, David McClain wrote:
>>I do find it amazing that C++ would be dumb enough to try to scaffold raw
>>stack frames, instead of using some kind of dynamic link pointers to reach
>>each frame C++. How in the world would any kind of cross-language
>>interoperability ever function if this were the case. Mind you I'm not

>I didn't catch which compiler you are using, but recent versions of G++
>_do_ use unwinding exception handling that would be thrown off by the ocaml
>stack frames.
He was using Apple's version of GCC on MacOS X, which definitely uses 
stack unwinding for handling exceptions.

In general, it's unreasonable to expect exceptions to work across 
language boundaries just because straightforward call interfaces do if 
there isn't a specifically documented way to deal with them.  With C++ 
in particular, since the details of exceptions are 
implementation-specific, they aren't even compatible across different 
C++ implementations, much less with other languages (unless specifically 
designed to be - e.g. presumably .NET C++).

Also, Unix signal handlers aren't really related to exceptions.  Signals 
can be asynchronous, while exceptions are thrown from specific points in 
code.  It's possible to translate some signals to exceptions safely 
(ones that are actually generated by specific instructions in the same 
thread), which I believe OCaml does, but the signal related stuff in the 
C interface is related to making asynchronous signal handlers written in 
OCaml safe to call.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: