PDA

View Full Version : [SOLVED] Initializing SDL?



dodle
March 3rd, 2011, 07:04 AM
I compiled some code that did not initialize SDL, it did not include the function:


SDL_Init();

and it seemed to work fine. So why does this function need to be called?

Zugzwang
March 3rd, 2011, 12:24 PM
I compiled some code that did not initialize SDL, it did not include the function:


SDL_Init();

and it seemed to work fine. So why does this function need to be called?

Because of cross-platform compatibility. On some platform, some operations might have to be performed before anything using SDL might start.

So, if you remove the call to SDL_Init, your code might cease to work on MacOS or Windows, for example.

dodle
March 3rd, 2011, 08:03 PM
Thank you for clarifying.