libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.
zlib License
572 stars 186 forks source link

IMG_Init and IMG_Quit always pull in all static libraries #475

Closed ccawley2011 closed 2 weeks ago

ccawley2011 commented 2 weeks ago

IMG_Init and IMG_Quit initialise and deinitialise libraries based on the value of the flag parameter, however most compilers are unable to remove unused code this way. IMG_Init is also called within the load functions, so even if a program only requires IMG_LoadPNG_RW, the linker will still pull in all of the other libraries, which significantly increases the size of the final executable.

slouken commented 2 weeks ago

That's correct. That's why dynamic loading of external dependencies is the default.

ccawley2011 commented 2 weeks ago

It's still an issue on platforms that don't support dynamic linking, though.

slouken commented 2 weeks ago

Then only build with support for the formats you want.