Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
46#ifndef BJ_MAIN_H
47#define BJ_MAIN_H
48
49#include <banjo/api.h>
50
51#if defined(BJ_COMPILER_DOXYGEN)
60#define BJ_NO_AUTOMAIN
61
69#define BJ_AUTOMAIN
70#endif
71
72#ifndef BJ_NO_AUTOMAIN
73# if defined(BJ_OS_EMSCRIPTEN)
74# define BJ_AUTOMAIN
75# elif defined(BJ_OS_WINDOWS)
76# define BJ_AUTOMAIN
77# elif defined(BJ_OS_IOS)
78# define BJ_AUTOMAIN
79# endif
80#endif
81
82#ifdef __cplusplus
83extern "C" {
84#endif
85
86#if defined(BJ_AUTOMAIN)
94extern int bj_main(int argc, char* argv[]);
95#endif
96
111extern int bj_call_main(int argc, char* argv[], int (*function)(int argc, char* argv[]));
112
113#ifdef __cplusplus
114}
115#endif
116
117#if !defined(BJ_NO_AUTOMAIN) && !defined(BJ_MAIN_NOIMPL)
118# if defined(BJ_AUTOMAIN)
119# ifdef main
120# undef main
121# endif
122# if defined(BJ_OS_WINDOWS)
123# ifndef WINAPI
124# define WINAPI __stdcall
125# endif
126 typedef struct HINSTANCE__* HINSTANCE;
127 typedef char* LPSTR;
128 typedef wchar_t* PWSTR;
129# ifdef BJ_COMPILER_MSVC
130# if defined(UNICODE) && UNICODE
131 int wmain(int argc, wchar_t* wargv[], wchar_t* wenvp) {
132 (void)argc; (void)wargv; (void)wenvp;
133 return bj_call_main(0, NULL, bj_main);
134 }
135# else
136 int main(int argc, char* argv[]) {
137 (void)argc; (void)argv;
138 return bj_call_main(0, NULL, bj_main);
139 }
140# endif
141# endif
142# ifdef __cplusplus
143 extern "C" {
144# endif
145# if defined(UNICODE) && UNICODE
146 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR szCmdLine, int sw) {
147# else
148 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {
149# endif
150 (void)hInst; (void)hPrev; (void)szCmdLine; (void)sw;
151 return bj_call_main(0, NULL, bj_main);
152 }
153# ifdef __cplusplus
154 }
155# endif
156# else
157 int main(int argc, char* argv[]) {
158 return bj_call_main(argc, argv, bj_main);
159 }
160# endif
161# define main bj_main
162# endif
163#endif
164
168
169#endif
General-purpose definitions for Banjo API.
int main(int argc, char *argv[])
Definition audio_pcm.c:177
int bj_main(int argc, char *argv[])
The user's main(), after Banjo renames it.
int bj_call_main(int argc, char *argv[], int(*function)(int argc, char *argv[]))
Forward into the user-supplied bj_main from a platform stub.