SDL2 library without threads error on SaveBMP

Dear all,

I am new to SDL2 and so far is a great experience.

I am the author of the Little Library Helper, https://github.com/franko/lhelper, where I have created a recipe to compile the SDL2 library on Windows and on Linux. The recipe may works also on Mac OS X but I never had the opportunity to test.

The recipe builds by default the library only with the video, render and events modules and additional modules are available as options.

So I come to the point, it is about the SDL_SaveBMP function. It is available without any additional module or maybe with the video module, not sure. Yet when I compile the library without the thread module the SDL_SaveBMP is available and works but it returns an error saying: “SDL not built with thread support”.

I do not understand why the SDL_SaveBMP needs the thread module and why it reports an error if it is actually able to perform its task.

Any clarification is welcome, thank you in advance.

Kind regards
Francesco

What platform have you built this on to test?

Examining the SDL_SaveBMP_RW function (which is where the SDL_SaveBMP macro leads), there isn’t any direct use of threading or synchronization primitives. However, it is highly likely that as the function requires access to the raw pixels of the surface that you would like to save, it would use a synchronization primitive to prevent other threads from changing the surface while the pixels are being read.

Does it produce the same error if you call SDL_LockSurface?