E
etienne
Hello all,
i'm experimenting a problem in trying to cast a char * variable to a
pointer to a function.
My problem is that I want to execute functions in threads, using the
pthread_create function.
The name of the functions are read in txt file at runtime.
So I want to do something like
char * func_to_run = scanf(the, good, args);
pthread_create (thread, attr, (magic cast)funct_to_run, arg);
In fact, what I need is not exactly a cast, it is something that gets
the pointer to the function that match the name in func_to_run.
The functions are compiled and linked somewhere in the executable.
Even better I would like to test, at runtime, that the provided name
in func_to_run is the name of a function that exists.
Is there a way to do this?
thanks for any help
Etienne
i'm experimenting a problem in trying to cast a char * variable to a
pointer to a function.
My problem is that I want to execute functions in threads, using the
pthread_create function.
The name of the functions are read in txt file at runtime.
So I want to do something like
char * func_to_run = scanf(the, good, args);
pthread_create (thread, attr, (magic cast)funct_to_run, arg);
In fact, what I need is not exactly a cast, it is something that gets
the pointer to the function that match the name in func_to_run.
The functions are compiled and linked somewhere in the executable.
Even better I would like to test, at runtime, that the provided name
in func_to_run is the name of a function that exists.
Is there a way to do this?
thanks for any help
Etienne