For a dynamic library .so file , we can use dlopen(), dlsym() to call functions inside a .so file.
Can the functions in .so call functions in main() executable? Most of the time it works, but not always. It's not very reliable.
A reliable way to let functions in .so call functions in main() executable is to save the fucntion address as a struct, and pass it to a .so initial function and .so save it.
function struct to pass |
typedef struct { void (*mf_hide_win_sym)(); … } |
save function address to pass to .so |
func->mf_hide_win_sym = hide_win_sym;
|
.so call main() exec function |
gmf.mf_hide_win_sym() |