Fixed bug 3926 - SDL_main export
authorSam Lantinga <slouken@libsdl.org>
Wed, 01 Nov 2017 17:41:25 -0700
changeset 11666b2d2705511d1
parent 11665 861f42ecf09a
child 11667 22aa48874257
Fixed bug 3926 - SDL_main export

e_pluschauskas

I noticed that after updating SDL to 2.0.6 my application now exports SDL_main.

At GitHub SDL mirror (branch 2.0.5) SDL_main prototyped as
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
but at branch 2.0.6 prototype is
extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
include/SDL_main.h
     1.1 --- a/include/SDL_main.h	Wed Nov 01 17:30:02 2017 -0700
     1.2 +++ b/include/SDL_main.h	Wed Nov 01 17:41:25 2017 -0700
     1.3 @@ -63,10 +63,13 @@
     1.4  /* On Android SDL provides a Java class in SDLActivity.java that is the
     1.5     main activity entry point.
     1.6  
     1.7 -   See README-android.md for more details on extending that class.
     1.8 +   See docs/README-android.md for more details on extending that class.
     1.9   */
    1.10  #define SDL_MAIN_NEEDED
    1.11  
    1.12 +/* We need to export SDL_main so it can be launched from Java */
    1.13 +#define SDLMAIN_DECLSPEC    DECLSPEC
    1.14 +
    1.15  #elif defined(__NACL__)
    1.16  /* On NACL we use ppapi_simple to set up the application helper code,
    1.17     then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 
    1.18 @@ -85,6 +88,10 @@
    1.19  #define C_LINKAGE
    1.20  #endif /* __cplusplus */
    1.21  
    1.22 +#ifndef SDLMAIN_DECLSPEC
    1.23 +#define SDLMAIN_DECLSPEC
    1.24 +#endif
    1.25 +
    1.26  /**
    1.27   *  \file SDL_main.h
    1.28   *
    1.29 @@ -107,7 +114,7 @@
    1.30  /**
    1.31   *  The prototype for the application's main() function
    1.32   */
    1.33 -extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
    1.34 +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
    1.35  
    1.36  
    1.37  #include "begin_code.h"