Yes, through the debugging interface when calling the engine through C++. You can pass a callback function pointer to engine_open. You'll find details in the comment in afuncs.h. There is no such mechanism in lite-C.