Can someone explain to me why SDL2.dll in version 2.0.12 has 1.2MB, and in version 2.0.20 2MB? I’m using an older version and I’ve never had anything go wrong…
It’s 0.8 MB better
But really, it’s because stuff has been added to SDL since then.
In this case, it was likely the addition of hidapi into the SDL.dll directly, instead of it being a separate library, but yes, lots of stuff has been added since 2.0.12 in general, too.
Possibly, I did not deal with USB … But since the size has increased 2x, it should be called SDL4
I love the way SDL is now just a .dll file per library that you want to use, rather than a long list of random dll files. Thank you!!!
So is zlib1.dll now not required? When did that happen (I still bundle it with my app, perhaps unnecessarily)?
are you sure you need(ed) it for SDL2 itself and not SDL2_Image or another addon lib?
I use SDL2, SDL2_ttf and SDL2_net, it could have been any of those that needed it (but on a quick test none do now).
Yes, there used to be a whole load of randomly named DLLs that seemed to need to be included when you distributed an app, now it seems like everything’s been rolled into just SDL2.dll, SDL2_image.dll, SDL2_mixer.dll, SDL2_ttf.dll and SDL2_net.dll
I love the tidiness of that! (I’m probably a bit OCD…)
Not everything…
In another discussion you explain that there should be separate libraries, and here it’s the other way around… Decide…
@ROSY Why are you always so combative?
Anyway, yes, if you want extras like MIDI support for SDL_mixer then you need to ship the appropriate extra DLLs, but if all you want is SDL_mixer itself then you can just ship SDL_mixer.dll. Ditto for SDL_image and supporting less common image formats like WebP.
So not everything… And what a combative…
For anyone like me who is concerned about keeping file sizes down, if you build the current 32-bit SDL3.dll using the VisualC project, it comes in at 1203 KB. Adding the preprocessor definition SDL_LEAN_AND_MEAN it will be further reduced to 776 KB. I had similar results with SDL2. This works on Android builds as well and my APKs way are under 1 MB.
I’ve never had to bundle any extra DLLs. For images I just use LodePNG.
Well, please… How do you compile for Android? I use the old method from the instructions, I want it to work in old versions, max 6.0. apk comes out much bigger… But it compiles under linux.
The default SDL3.dll requires 11.7 MB when I build it with MinGW. I need OpenGL only. I have disabled all subsystems in CMake GUI except of Video
and Joystick
:
Subsystems:
Audio: OFF
Video: ON
Render: OFF
Camera: OFF
Joystick: ON
Haptic: OFF
Hidapi: OFF
Power: OFF
Sensor: OFF
Dialog: OFF
I have unchecked all checkboxes except of:
SDL_HIDAPI_JOYSTICK
SDL_JOYSTICK
SDL_OPENGL
SDL_OPENGLES
SDL_SHARED
SDL_STATIC
SDL_VIRTUAL_JOYSTICK
SDL_VIDEO
Size of SDL3.dll is 6.85 MB. The UPX app reduces a size of SDL3.dll from 6.85 MB to 1.94 MB:
upx.exe --best SDL3.dll
Can I make it smaller or it is a minimum size for MinGW?
As far as I know, you can still deactivate the debugger information.
Does SDL3.dll keep the debug information? How deactivate it?
I tried the following, it’s more than double.
With debug
$ cmake -DCMAKE_BUILD_TYPE=Debug ../SDL/
Without debug
$ cmake -DCMAKE_BUILD_TYPE=Release ../SDL/
There is such an option in CMake-GUI. This field is empty by default. I think it is set to “Debug” by default. I have write Release
there. I was build with the default setting (with Debug) and to Release:
- Debug SDL3.dll - 12.0 MB
- Release SDL3.dll - 17.9 MB
I find it very strange that the Release build is 5.9 MB larger than the Debug build.
I don’t know if it makes a difference but the SDL CMake docs mentions both -DCMAKE_BUILD_TYPE=Release
(in the “configure” step) and --config Release
(in the “build” step).
I think CMAKE_CXX_FLAGS_RELEASE
use -O3
by default. Using -O2
should reduce the size and might not be (that much) slower.