Author Topic: Problems on Windows 10  (Read 2664 times)


  • Hero Member
  • *****
  • Posts: 10784
Re: Problems on Windows 10
« Reply #15 on: January 26, 2021, 06:18:37 pm »
The hook is readily available, see:

Mind the use of sysutils may want you to chain the order, but the hook is there.
« Last Edit: January 26, 2021, 06:20:20 pm by Thaddy »

Peter H

  • Full Member
  • ***
  • Posts: 197
Re: Problems on Windows 10
« Reply #16 on: January 26, 2021, 07:29:00 pm »
As said, console processes always terminate this way.
Just for the record, all processes that end _normally_ whether console or GUI, end with a call to ExitProcess.  In a language such as Pascal, the call is not visible because it is part of the RTL.  Also, there are other ways to terminate a process but none of them are considered normal and/or desirable.
Recently I had a C++ Windows GUI program, dealing with threads, that did not fully terminate, because not all Threads where terminated.
The threads where I/O blocked and could not self terminate.
I tested the behaviour of a Free pascal Program with threads and indeed it terminates when the close button is pressed despite threads running.
In this case however, gdb does not terminate, so there is still something wrong. At a subsequent debug session there are problems.
(I started the thread with BeginThread, dont know if that matters) Now I must reboot, all ghost processes removed, but still problems with debugging.  ;D

the debuggee terminates not, if an unhandled exception e.g. 1/0 happens.
So a call to Exitprocess in an exception handler could be required in this case.
« Last Edit: January 26, 2021, 08:12:07 pm by Peter H »


  • Hero Member
  • *****
  • Posts: 2130
    • Additional info
Re: Problems on Windows 10
« Reply #17 on: January 27, 2021, 08:30:03 am »
Any ideas, someone had the same problems?
I would use something like MultiLog and see what is missing in log during app exit. That would give a pointer to what hangs.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib


  • Hero Member
  • *****
  • Posts: 3062
  • Compiler Developer
Re: Problems on Windows 10
« Reply #18 on: January 27, 2021, 08:57:28 am »
In the case of Pascal (and many other languages such as C and C++), the "disadvantage" of calling ExitProcess in the application itself is that the language's RTL does not get a chance to do any cleanup of any internal resources it may be using.   This is a "non problem" because whatever the RTL failed to cleanup, the O/S will clean up.

While cleaning up used resources usually isn't a problem, what can be a problem is if some things aren't flushed. Thus one should always cleanup nicely by oneself to make sure that everything that should be OS-side is OS-side. ;)


TinyPortal © 2005-2018