Hey all,
I didn't post this in the beginners section as I think it is abit advanced for it, but here is my problem:
Basically, I have made a program which implements the platform specific layers (such as entry function, file loading, timing functions etc.) that gets compiled into a .exe (or platform equivalent).
But I want to make this portable and reusable across other projects, so the entry function for the platform will call the function "AppMain" which is the generic main function that is not reliant on the underlying platform etc. (i.e defined in a .h file that the project module will implement).
Ideally I would want to build the AppMain code into its own library. However, This AppMain code would want access to the Platform functions such as the functions compiled into the .exe.
This has confused me somewhat and has forced me to build both the AppMain module and the Platform Code into the same exe file so they can use each others functions.
Is there any way I can create a header file (with all the function prototypes in) but they do not get implemented in the Platform code but rather they can be 'guaranteed' to be available at runtime?
Sorry if this sounds confusing (as I am quite confused by it myself) but here is what I am trying to achieve in a high level view:
win32layer.cpp: (implements all the functions defined in Platform.h)
1 2 3 4 5 6 7
|
#include <AppMain.h>
int main(int argc, char** argv)
{
//call AppMain
return AppMain(argc, argv);
}
|
AppMain.h: (defines the functions that each new project has to implement)
int AppMain(int argc, char** argv);
AppMain.cpp:
1 2 3 4 5 6 7 8 9
|
#include <AppMain.h>
#include <Platform.h>
int AppMain(int argc, char** argv)
{
//print hello world to the platform output
Platform_Log("Hello, World\n");
return 0;
}
|
in this scenario of course I could not compile the platform functions as the application has not been created and thus appmain cannot call the platform functions because that has not been created etc....
Anyone know of any way to overcome this?
Thanks,
Nick