is it possible but I guess that memory is read only. I tried something like that
void (*b)();
b = *test;
char * z = (char * )b;
and when I print contents of z, it prints constants from test function.
but that memory is read only and I get segfaults when I edit them and call test. I tried this.
char x[100];
for(i=0; i<100; i++) x[i] = z[i];
b = (void(*)())x;
b();
and segfault again.
I know this is kinda stupid, but is there a way to do this? I think there is a way to change code memory to read/write but what I really need is being able to send functions over network and make a remote machine to run them.
edit: this is not for malicious use. what I trying to achieve creating a network which can share code parts between them and run a program parallelly on different part of same input