WinMain is specified by the Win32 API as having extern "C" linkage

Fixes https://github.com/libsdl-org/SDL/issues/8814
This commit is contained in:
Sam Lantinga 2024-01-10 06:25:49 -08:00
parent 6407e0cc37
commit 9a77813df0
1 changed files with 13 additions and 0 deletions

View File

@ -100,6 +100,10 @@ int main(int argc, char *argv[])
#endif /* _MSC_VER && ! __GDK__ */ #endif /* _MSC_VER && ! __GDK__ */
/* This is where execution begins [windowed apps and GDK] */ /* This is where execution begins [windowed apps and GDK] */
#ifdef __cplusplus
extern "C" {
#endif
#if defined( UNICODE ) && UNICODE #if defined( UNICODE ) && UNICODE
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR szCmdLine, int sw) int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, PWSTR szCmdLine, int sw)
#else /* ANSI */ #else /* ANSI */
@ -112,6 +116,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
(void)sw; (void)sw;
return SDL_RunApp(0, NULL, SDL_main, NULL); return SDL_RunApp(0, NULL, SDL_main, NULL);
} }
#ifdef __cplusplus
} /* extern "C" */
#endif
/* end of __WIN32__ and __GDK__ impls */ /* end of __WIN32__ and __GDK__ impls */
#elif defined(__WINRT__) #elif defined(__WINRT__)
@ -163,10 +170,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
#pragma comment(lib, "runtimeobject.lib") #pragma comment(lib, "runtimeobject.lib")
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{ {
return SDL_RunApp(0, NULL, SDL_main, NULL); return SDL_RunApp(0, NULL, SDL_main, NULL);
} }
#ifdef __cplusplus
} /* extern "C" */
#endif
/* end of WinRT impl */ /* end of WinRT impl */
#elif defined(__NGAGE__) #elif defined(__NGAGE__)