ccall_create — Inter C module calling wrapper.
extern int ccall_create( | void** dest, | |
void* call, | ||
void* pw) ; |
dest Pointer to a void* to place the result. |
call Function to be called through this. |
pw The private word to get the proper workspace for the call. |
Inter C module calling wrapper
ccall_create makes a small piece of code so that one module's C code can call another, or an external caller can enter the C code with the correct workspace setup.
There are a number of limitations: - variable argument functions are not supported - you can only pass 4 registers worth of arguments through - the calling mode must be SVC
the space for the code-segment is currently allocated out of the RMA, and as such, should be freed after the user has done with it.
An example piece of code, where my_example_routine needs to be called by another piece of C... <programlisting> void *example_entry; void *my_pw; int my_example_routine(args); void init_entry(void) { ccall_create(&example_entry, my_example_routine, my_pw) } void fini_entry(void) { ccall_free(&example_entry); } </programlisting>