[Openmcl-devel] win32 exception compatibility

Matthew Claus matt at mclaus.com
Mon Jun 1 13:07:17 PDT 2009


Hi all, let me first say thank you to everyone who has helped produce 
and make available such an outstanding tool. I'm having a lot of fun 
with it.

I am a complete novice with Clozure CL, so please take this question in 
that context. I'm running on 32 bit Windows XP SP2, using both the 
release and trunk version from subversion.

Is CCL fundamentally compatible with foreign C++ code (built with 
Microsoft Visual C++) that may internally use C++ exceptions?

I am calling a function in a foreign library and ending up at the lisp 
kernel debugger. I believe this is because the Microsoft compiler 
implements C++ exceptions with windows structured exceptions and as 
such, any throw in foreign code results in the CCL vectored 
exception handler being called. In this case, the debugger is 
entered on x86-exceptions.c, line 1992.

I found this article on MSDN (http://support.microsoft.com/kb/185294) 
which identifies the exception code used by the VC compiler in implementing C++ 
exceptions. I patched windows_arbstack_exception_handler like this:  

   if ((current_sp >= cs->low) && 
       (current_sp < cs->high)) { 
     debug_show_registers(context, exception_pointers->ExceptionRecord, 0); 

-->  if(code == 0xE06D7363){ 
-->    return EXCEPTION_CONTINUE_SEARCH;
--> } 
     FBug(context, "Exception on foreign stack\n"); 
     return EXCEPTION_CONTINUE_EXECUTION;
   }

Now my application is working fine but I'm wondering if I'm simply 
doing something wrong in the first place, if there is a better 
approach to solving this problem, or if calling foreign C++ code that 
is internally using exceptions is not intended to work at this time.

Thanks very much for your thoughts and assistance,

Matt





More information about the Openmcl-devel mailing list