I am writing a shared object (.so) in C, and I want to pass a pointer to an array into the program and pass a pointer to a different array back to the calling function.
My main signature is:
int main(int argc, char **argv)
However, I want to pass in a pointer to an array, and in C it's not done in the way functions work in some other languages -- for example, function(*data).
My questions are:
How do I pass an array pointer in?
How do I pass an array pointer back?
I'm new to C (coming from other languages). I've researched it for some time now and all examples show passing and returning a pointer from an inside function other than the main function. The helpful research I have seen says that it's not possible to return a pointer from main, but is there any way to dynamically allocated (malloc) memory in a shared object and return it to the caller?
Thanks for any help on this.