Add support for hook in trainer.
Remove comm.dll dependency.