failsoft, external functions and exception handlers
Posted: Fri Aug 07, 2009 12:20 pm
by johnmunro >> Fri, 17 Jan 2003 11:45:18 GMT
We have just created a C++ DLL consisting of some code that takes a long time to run in Jade but is quick in C.
It ocurred to me that we could make the system "failsoft". The system would by default try to use the DLL, and if it was missing for whatever reason, instead of raising an exception would fall back to the native Jade version of the code.
The method I'm using is as below:
processFile(fileName : String) : Boolean;
varsbegin
on Exception do processFileExceptionHandler(exception);
return call processFile(fileName);
return processFileNative(fileName);
end;
So in order for this to work, the exception handler needs to return Ex_Continue or Ex_Resume_Next, but the "Entry point not in library" exception is non-continuable and non-resumable.
I can't work out how to arrange the exception handler and methods to be able to try something and if that fails do something else...
I had a similar problem with ActiveX controls which weren't installed on client machines, and solved it with app.isActiveXClassIdRegistered(Class.GUID).
Unfortunately I can't find anything similar for external functions, like app.isEntryPointInLibrary or something...
John Munro
---
Synergist Limited - Home of FileVision
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com
The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact Synergist Limited immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. Synergist Limited cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform Synergist Limited.
We have just created a C++ DLL consisting of some code that takes a long time to run in Jade but is quick in C.
It ocurred to me that we could make the system "failsoft". The system would by default try to use the DLL, and if it was missing for whatever reason, instead of raising an exception would fall back to the native Jade version of the code.
The method I'm using is as below:
processFile(fileName : String) : Boolean;
varsbegin
on Exception do processFileExceptionHandler(exception);
return call processFile(fileName);
return processFileNative(fileName);
end;
So in order for this to work, the exception handler needs to return Ex_Continue or Ex_Resume_Next, but the "Entry point not in library" exception is non-continuable and non-resumable.
I can't work out how to arrange the exception handler and methods to be able to try something and if that fails do something else...
I had a similar problem with ActiveX controls which weren't installed on client machines, and solved it with app.isActiveXClassIdRegistered(Class.GUID).
Unfortunately I can't find anything similar for external functions, like app.isEntryPointInLibrary or something...
John Munro
---
Synergist Limited - Home of FileVision
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com
The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact Synergist Limited immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. Synergist Limited cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform Synergist Limited.