AddHook

This function adds a global hook. Hooks are callback functions that will be executed when certain events occur.

Syntax

Parameters

Example

#include "Leadwerks.h"

using namespace Leadwerks;

void MyHook(char* error)
{
std::string s = std::string(error);
System::Print(s);
// -- set a breakpoint here and view the printed output
}
int main(int argc, const char *argv[])
{
//Add a hook
System::AddHook(System::DebugErrorHook, MyHook);

//Induce an error
Debug::Error("Something went wrong!");

return 0;
}