[fpc-pascal] InterlockedExchangeAdd64

Jonas Maebe jonas at freepascal.org
Sat Jan 11 12:07:45 CET 2025


On 11/01/2025 07:53, Adriaan van Os via fpc-pascal wrote:
>> Am 10.01.2025 um 15:43 schrieb Adriaan van Os via fpc-pascal:
>>>
>>> But now I install a system.ErrorProc and run the same program. It 
>>> emits, instead of the EBusError, Runtime Error 214.
>>>
>>> This puzzles me.
>>
>> This is as designed, because the ErrorProc is what is used by the 
>> SysUtils unit to convert runtime errors to exceptions. If you want to 
>> implement your own handling, then store the original value of 
>> ErrorProc, assign your own handler, do your own handling and at the 
>> end call the saved ErrorProc.
> 
> I don't want to handle the error, I want a meaningful error. And Runtime 
> Error 214 "Collection overflow" is nonsense.

The sole purpose of overriding System.ErrorProc is to handle errors by 
yourself. If you don't want to handle a particular error, do as Sven 
said (call the original System.ErrorProc), and then whatever custom 
error handler that was there before will do its thing. In this case: the 
error handler that was installed by the SysUtils unit, which will raise 
an EBusError exception (which seems to be what you want).


Jonas


More information about the fpc-pascal mailing list