I was wondering if there is a way to have user defined functions?
Here is my situation, I'm trying my hand at multi-platform code.
I have a source file that has multiple main functions meant for their specific platform. When I compile a specific platform, the main function for that platform will be the one available and act as the programs entry point. So for example:
Desktop compile would have and use the typical main:
void main()
{
//Program entry point
}
Where compiling for Android would use and have this main function:
ANativeActivity_createFunc AndroidStart;
void AndroidStart (ANativeActivity *activity, void *savedState, size_t savedStateSize)
{
//Program entry point
}
Now I'm looking to have some user defined functions for Update and Render. Where these are automatically called by the internals of my code, but are what the user needs to have. Something like:
//In the internals of on my android application
void MainThreadRun()
{
while(running)
{
HandlePollData();
//User functions that the user made
UserDefinedUpdate();
UserDefinedRender();
}
}
I was hoping I could do something like an extern method, but seeing that I want to package my code up as a SO / DLL library. Making methods like those and declaring them extern cause linker errors. Which makes sense cause they would not be declared in my code.
So what can I do? What are some better options?