typedefstructHooks {
void*(*malloc_fn)(size_tsz);
void (*free_fn)(void*ptr);
} Hooks;typeHooksstruct {
MallocFn c.PointerFreeFn c.Pointer
}Due to the characteristics of LLGo, an anonymous function type cannot be directly declared as a Field Type. Currently, the Field Type for an anonymous function is only mapped to c.Pointer, but this causes the original type information to be lost. To solve this problem, we can additionally declare a function type annotated with llgo:type C and reference it.
typedefstructHooks {
void*(*malloc_fn)(size_tsz);
void (*free_fn)(void*ptr);
} Hooks;// llgo:type CtypeLLGO_HOOKS_MallocFnfunc(c.SizeT) c.Pointer// llgo:type CtypeLLGO_HOOKS_FreeFnfunc(c.Pointer)
typeHooksstruct {
MallocFnLLGO_HOOKS_MallocFnFreeFnLLGO_HOOKS_FreeFn
}
Due to the characteristics of LLGo, an anonymous function type cannot be directly declared as a Field Type. Currently, the Field Type for an anonymous function is only mapped to
c.Pointer, but this causes the original type information to be lost. To solve this problem, we can additionally declare a function type annotated with llgo:type C and reference it.