12.4.22 Foreign Code Hooks
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Foreign Code Hooks
            • PL_dispatch_hook()
            • PL_abort_hook()
            • PL_abort_unhook()
            • PL_on_halt()
            • PL_exit_hook()
            • PL_agc_hook()
    • Packages
Availability:C-language interface function
void PL_on_halt(int (*f)(int, void *), void *closure)
Register the function f to be called if SWI-Prolog is halted. The function is called with two arguments: the exit code of the process (0 if this cannot be determined) and the closure argument passed to the PL_on_halt() call. Handlers must return 0. Other return values are reserved for future use. See also at_halt/1.bugAlthough both PL_on_halt() and at_halt/1 are called in FIFO order, all at_halt/1 handlers are called before all PL_on_halt() handlers. These handlers are called before system cleanup and can therefore access all normal Prolog resources. See also PL_exit_hook().