Alternative to SDL to use with TCC

Started by
3 comments, last by bubu LV 10 years, 3 months ago
I am making a programming langauge that use the "Tiny C Compiler" as one of the backends and I try to find a suitable media layer for games.

I tried using "Simple Direct media Layer 2.0.1" because it was written in C and use the zlib license but it's redefinition of Main made it incompatible with TCC. The version specific workaround looks like a mess that no user of my language would accept. The resulting C code must be directly compatible with almost any C compiler without modifications so that beginners can recompile it.
Advertisement

If you are not worried about Android/iOS/psp platforms, then you can simply define SDL_MAIN_HANDLED preprocessor symbol, and SDL won't override main.

If you are not worried about Android/iOS/psp platforms, then you can simply define SDL_MAIN_HANDLED preprocessor symbol, and SDL won't override main.

Thanks! The compiler don't complain any more and this should be portable enough.

Is there any initiation and termination code that I have to call instead?

I noticed another problem. SDL have a static library that needs to be linked from the compiler but the code for linking libraries is different for every C compiler.

I might have to change compiler to something with multiple target platforms so that I can use any essential compiler features but TCC is the only small C compiler that I know of.

You can always compile SDL to shared library - dll or so file. And use that instead of static lib.

As for initialization - only Android, iOS and PSP needs special code. Other platforms will work fine without SDL_main.

This topic is closed to new replies.

Advertisement