Silverfrost Forums

Welcome to our forums

select_printer@

18 Jun 2025 3:26 #32176

The next release of salflibc64.dll includes an extenion to TRAP_EXCEPTION@ for x64. Here is some sample code that illustrates the extension.

integer(7) function Handler()
 include <EXCEPTN.INS>
 print*,'Processing Handler'
 Handler = CONTINUE_EXECUTION
end function

integer(7) function Handler0()
 include <EXCEPTN.INS>
 print*,'Processing Handler0'
 Handler = NONCONTINUABLE_EXCEPTION
end function

program test
 integer,parameter::INT_DIVIDEBY_ZERO=14 
 integer(7),external::Handler,Handler0
 integer(7) prevHandler,TRAP_EXCEPTION@
 !Note: TRAP_EXCEPTION@ returns integer(7).
 prevHandler = TRAP_EXCEPTION@(INT_DIVIDEBY_ZERO, Handler0)
 prevHandler = TRAP_EXCEPTION@(Z'80010012',       Handler)
 i = 0
 k = 10/i
end program test

The extension allows the exception number Z'80010012' to be used as the first argument.

If recovery after exception Z'80010012' is possible then CONTINUE_EXECUTION can be used in the handler.

If recovery is not possible (as in divide by zero) then NONCONTINUABLE_EXCEPTION must be used.

This will allow you to test if the exception is literally an error or something that will be absorbed later within the relevant Windows API call.

p.s. I am assuming that it is an internal Microsoft error that hopefully they will fix in due course.

19 Jun 2025 5:36 #32180

Paul, Thanks for looking into it. Is there an upfront release available so I can test it? Regards Ian

21 Jun 2025 9:50 #32187

Paul, Well done, that has done the trick. Normally it crashed within a few seconds. The print statement in the handler notified me that the exception has occurred. The program kept on running. Print statement removed and it still works. Regards Ian

Please login to reply.