Re: [AD] support for mod files

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2010-04-05 at 12:22 -0500, Matthew Leverton wrote:
> >No, it's all compile-time. addons/image/iio.c has #ifdefs for PNG and
> >JPEG. So if you disable them they don't get compiled in and they don't
> >get linked in.
> >
> Right, but on Windows, building Allegro is not very fun. Installing
> cmake, hunting down the libraries, building them with the proper CRTs,
> and making sure they are named just right just for Allegro is going to
> turn a lot of people away. As such, most people will simply use the
> pre-built version.
> 
> Pre-built versions will of course include all features. So if somebody
> loads any type of image, even a BMP file, iio.c will mention
> al_load_png and al_load_jpg which brings in PNG and JPEG, and all of a
> sudden, their simple program now depends on five DLLs.

Are DLLs a problem? I never use static linking myself, just so I can
always see at a glance how much code is where (even my games might use
multiple .dlls, like have the server in its own .dll for obvious
reasons).

> >From this POV, the image addon should probably act like the audio
> >addons.  But I get the feeling most people want PNG support anyway,
> >and many people probably want JPG support.  So would it be worth
> >splitting image up into _image, _png and _jpg?
> >
> Originally, I probably would have said it's not worth it. But the
> problem will only get worse if more image formats are supported. Also,
> I think having a monolithic module may cause people to be more
> hesitant to add support for other formats.
> 
> You could almost get the best of both worlds if there is an optional
> include file like:
> 
> ~~~~
> #ifdef ALLEGRO_CFG_IIO_HAVE_PNG
> #include "allegro5/allegro_png.h"
> #endif
> 
> #ifdef ALLEGRO_CFG_IIO_HAVE_JPG
> #include "allegro5/allegro_jpg.h"
> #endif
> 
> #define al_register_all_images() ...
>  // al_init_jpeg_addon()
>  // al_init_png_addon()
> ~~~~
> 
> Then you could do something like:
> 
> #include <allegro5/image.h>
> 
> al_register_all_images();
> 
> The behavior would be the same as the current one (dependent on all
> external libs). However, if you explicitly chose to include just PNG,
> you could do so.
> 
> The difference would be an extra allegro_jpeg or allegro_png library.
> 
> I don't really know which is ultimately better when taking all the
> platforms into consideration.
> 

I like this solution. Especially for the acodec addons we should do it.
Also, the current situation is definitely broken (audio examples won't
build unless you have libdumb installed on your system).

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/