SDL2 platform specific code

Before the SDL 2.0 code base grows too much I wanted to ask about how
platform specific code will be handled. That is, will it be simple with:
#ifdef WIN32
some_windows_function();
#endif
#ifdef LINUX
some_linux_function();
#endif
or could a more ‘pretty’ system be used, such as if function foobar()
needs to be implemented differently on different platforms, then code
each platform specific implementation in $SDL_2_DIR/$PLATFORM/foobar.c
and just compile and link the correct implmentation. A plus to this
method could be the inclusion of a “default” platform which uses
techniques not optimized for any specific system but which should work
anywhere (even its the effect is to do nothing at all) and then if a
platform gets its own implementation of the function, just write the new
file. the makefiles/configure scripts would do all the “which files to
compile” figuring out.

any comments?

or could a more ‘pretty’ system be used, such as if function foobar()
needs to be implemented differently on different platforms, then code
each platform specific implementation in $SDL_2_DIR/$PLATFORM/foobar.c
and just compile and link the correct implmentation. A plus to this
method could be the inclusion of a “default” platform which uses
techniques not optimized for any specific system but which should work
anywhere (even its the effect is to do nothing at all) and then if a
platform gets its own implementation of the function, just write the new
file. the makefiles/configure scripts would do all the “which files to
compile” figuring out.

any comments?

This is how it is done currently :slight_smile: Have you not read the src and auto*
scripts ?

Cheers

JG

J. Grant wrote:

or could a more ‘pretty’ system be used, such as if function foobar()
needs to be implemented differently on different platforms, then code
each platform specific implementation in $SDL_2_DIR/$PLATFORM/foobar.c
and just compile and link the correct implmentation. A plus to this
method could be the inclusion of a “default” platform which uses
techniques not optimized for any specific system but which should work
anywhere (even its the effect is to do nothing at all) and then if a
platform gets its own implementation of the function, just write the
new file. the makefiles/configure scripts would do all the “which
files to compile” figuring out.

any comments?

This is how it is done currently :slight_smile: Have you not read the src and auto*
scripts ?

Cheers

JG

apparently i havent. ill read the rest of the files, ive already gone
through most the headers and source files. woo its exciting!