Refactoring of Cgo callbacks and HOOK(x) macro.