Sign in to follow this  
Dawoodoz

Alternative to SDL to use with TCC

Recommended Posts

Dawoodoz    461
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.

Share this post


Link to post
Share on other sites
bubu LV    1436

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.

Share this post


Link to post
Share on other sites
Dawoodoz    461

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?

Share this post


Link to post
Share on other sites
Dawoodoz    461

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.

Edited by Dawoodoz

Share this post


Link to post
Share on other sites
bubu LV    1436

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this