Jump to content
  • Advertisement
Sign in to follow this  
Dawoodoz

Alternative to SDL to use with TCC

This topic is 1633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!