[ODE] Exception Handling

Jon Watte (ODE) hplus-ode at mindcontrol.org
Wed Jan 31 15:33:07 MST 2007

Well, as it is, the functions are declared as extern "C," which will 
mean that exceptions passing to that layer will generally cause a 
program termination (unless you happen to be in luck on runtime library 
matching). On the other hand, ODE doesn't throw exceptions on its own, 
so we're pretty good there.

If we want to introduce exceptions in the ODE internals, then we should 
also catch those exceptions before returning from the extern "C" 
functions. However, exceptions do have an overhead on Windows (each 
"try" has a cost).


			/ h+

Bram Stolk wrote:
> On Tue, 2007-01-30 at 13:32 -0800, Jon Watte (ODE) wrote:
>> C linkage means that people using Delphi, or Visual Basic, or even plain 
>> C, can use the library. It also makes for a simple P/Invoke import path 
>> to managed languages (such as C#). With native C++ exceptions in the 
>> mix, it's a whole other ballpark -- while you might still be able to 
>> link against the ODE library, any exception thrown will likely end up 
>> with application termination.
>> We keep getting questions about using ODE in all kinds of wacky 
>> languages, so I assume it's something that's actively used.
>> Also: with C linkage, ODE is not compiler version dependent. With C++ 
>> linkage, each version of Visual Studio (or GCC) would need its own copy 
>> of the DLL.
> Jon, you mentioned that all exceptions should be caught within the API.
> If we do this... will that save us from the linkage problems?
> If so, I think we should pursue this for 0.9
> Personally, I run my apps outside an IDE, also, I don't use gdb much,
> so having exceptions would help me trace denormals without having me
> to put breakpts in gdb runs.
>   Bram
>> Cheers,
>>              / h+
>> STenyaK (Bruno Gonzalez) wrote:
>>> On Tue, 30 Jan 2007 07:17:11 +0100, michael kapelko <kornerr at gmail.com>  
>>> wrote:
>>>>  >> That's not possible with the stated goal of the ODE API, which is to
>>>> be C linkable
>>>> Then these won't be *real* exceptions, but pseudo-exceptions. I don't
>>>> get the use of adding pseudo-things.
>>> Why is C-linkage needed? How many people use it? Maybe losing C-linking  
>>> ability would not be that bad (but only "maybe"! that's why i ask).
>> _______________________________________________
>> ODE mailing list
>> ODE at ode.org
>> http://mooshika.org/mailman/listinfo/ode

More information about the ODE mailing list