Luna/libos/src/Main.cpp
apio bc07cc94cb
All checks were successful
continuous-integration/drone/push Build is passing
libos: Document it entirely using Doxygen comments =D
Also, add copyright information to individual files. This is going to be a hassle to do for EVERY file.
2023-06-09 22:45:06 +02:00

34 lines
732 B
C++

/**
* @file Main.cpp
* @author apio (cloudapio.eu)
* @brief Alternative C++ main function.
*
* @copyright Copyright (c) 2023, the Luna authors.
*
*/
#include <errno.h>
#include <os/Main.h>
#include <stdio.h>
int g_argc;
char** g_argv;
// This function will only be linked into the final binary if the user does not already define main(), which implies
// that they should have defined luna_main() instead. If not, good for them: linker errors!
__attribute__((weak)) int main(int argc, char** argv)
{
g_argc = argc;
g_argv = argv;
int result;
bool ok = luna_main(argc, argv).try_set_value_or_error(result, errno);
if (!ok)
{
perror(g_argv[0]);
return 1;
}
return result;
}