[freetds] FreeTDS, C++, and Exceptions

Lenon Kitchens lenonk at sanctuary.org
Sat Jun 17 13:13:54 EDT 2006


Frediano Ziglio wrote:
> :( this is bad C++... a C callback implemented in C++ should not throw
> exceptions... C do not support unwinding so you are doing something
> wrong. You could recompile all FreeTDS using a C++ compiled but code is
> not exception safe (cause C do not support exception) so you would
> convert a core in leaks... you should save error in a place, and outside
> FreeTDS detect this error and throw exception.
>
> bye
>   freddy77
>   
That was actually my first solution.  The problem with it is that 
sometimes after calling the callback functions FreeTDS calls abort() and 
never returns control to my library.  This is absolutely unacceptable.  
Because my library is actually loaded and used by TCL code that doesn't 
necessarily fail after a bad SQL execution, I must eventually return 
control to the TCL script in every scenario.  Therefore, saving an error 
(an exception in my case) and throwing it after the FreeTDS call that 
caused an error is unreliable at best.

Any other solutions to this problem?

Thanks,
  Lenon


More information about the FreeTDS mailing list