MainDocs:Cross-Platform Application Main

From ClanLib Game SDK

Sometimes you might want a cross platform main so you do not have to switch between WinMain() on windows or int main() on linux.

ClanLib provides that functionality.


First, include the headers:

#include <ClanLib/core.h>
#include <ClanLib/application.h>


Second, you need to simply define a main function of this signature:

int YOUR_NAME(const std::vector<CL_String> &args)


Thirdly and finally, create an instance of CL_ClanApplication with the name of your function

CL_ClanApplication app(YOUR_NAME);


Its that simple!!