OnErrorCall not working

All bugs related to new C backend
tored
User
User
Posts: 61
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

OnErrorCall not working

Post by tored »

Can't get OnErrorCall example in the manual to work with the C backend. However the OnErrorGoto example does work.

Code: Select all

  
  Procedure ErrorHandler()
    MessageRequester("OnError test", "The following error happened: " + ErrorMessage())
  EndProcedure

  MessageRequester("OnError test", "Test start")

  OnErrorCall(@ErrorHandler())
  Pokes(10, "Hello World") ; Cause a #PB_OnError_InvalidMemory error
  
  MessageRequester("OnError test", "This should never be displayed")

Make sure to create a separate executable to test it.

PureBasic 6.04 LTS (Windows - x64)
User avatar
ChrisR
Addict
Addict
Posts: 1150
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: OnErrorCall not working

Post by ChrisR »

The bug seems to be only with C Backend x64. It looks good with C Backend x86.
juergenkulow
Enthusiast
Enthusiast
Posts: 556
Joined: Wed Sep 25, 2019 10:18 am

Re: OnErrorCall not working

Post by juergenkulow »

Code: Select all

; Again OnErrorGoto and OnErrorGosub on Windows 6.10 Beta 5 x64 C Backend do not work. 
OnErrorGoto(?ErrorHandler)
PokeS(10, "Hello World") 
End
ErrorHandler:
OpenConsole()
Print("OnError test")
End   
CompilerIf #PB_Compiler_LineNumbering=0
  CompilerError "Please switch Compiler Option OnError on."
CompilerEndIf
CompilerIf #PB_Compiler_Debugger=1
  CompilerError "Please switch Compiler Option Start Debugger off."
CompilerEndIf
CompilerIf #PB_Compiler_Backend<>#PB_Backend_C Or #PB_Compiler_Processor<>#PB_Processor_x64 Or #PB_Compiler_OS<>#PB_OS_Windows
  CompilerError "Please use Windows x64 C Backend."
CompilerEndIf 
https://www.purebasic.fr/english/viewtopic.php?t=78569
Post Reply