Re: [AD] Allegro5 and colors |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
----- Original Message -----
From: "Eric Botcazou" <ebotcazou@xxxxxxxxxx>
To: "Allegro Developer" <conductors@xxxxxxxxxx>
Sent: Tuesday, September 10, 2002 2:28 PM
Subject: Re: [AD] Allegro5 and colors
> > I thought that passing and returning structs was handled differently on
> > different compilers, even on different windows compilers. Thus the dll's
> > built with one compiler don't work with programs built with another
> > compiler.
>
> I agree with Sven: passing structures by value is not the best thing to
do.
> Take a look at the "Interfacing to GCC output" section of the info manual
of
> GCC 2.95
What about using a double (8 bytes) and typecasting it
Something like
typedef double AL_COLOR;
AL_COLOR al_map_rgba(BITMAP *bmp, int r, int g, int b, int a) {
unsigned char x[8] = { r, g, b, a, 0, 0, 0, 0 };
return *(AL_COLOR *)x;
}
That way the user would use it as an int and wouldn't know what's going on
thanks to the typedef (and it is a standard
C type, isn't it?)