C: how to implement dynamic function copying?
I have a static function which is meant for receiving C-style callbacks. Doing some experiments with multithreading approaches, want to try a way of receiving callback into functions at different addresses, but do not want to declare all of them in code, rather copying a function (with its entrypoint) to another address in memory, and registering that adrress with a callback. Also it is required to determine address of function entrypoint at the function body..

Any possiblity to reach this with C and particularly with gcc on Linux?

*Note: in my case, callback happens with an argument, which is unique for it's source - so I have no problems with distinguishing callback origins.. however, I feel the need of described approached for multithreaded+forked environment*
C: how to implement dynamic function copying?
===

I have a static function which is meant for receiving C-style callbacks. Doing some experiments with multithreading approaches, want to try a way of receiving callback into functions at different addresses, but do not want to declare all of them in code, rather copying a function (with its entrypoint) to another address in memory, and registering that adrress with a callback. Also it is required to determine address of function entrypoint at the function body..

Any possiblity to reach this with C and particularly with gcc on Linux?

*Note: in my case, callback happens with an argument, which is unique for it's source - so I have no problems with distinguishing callback origins.. however, I feel the need of described approached for multithreaded+forked environment*