Re: [AD] Weak symbols in *nix (was: [AD] Magic main in Windows)

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


On Monday 02 August 2004 14:37, Sam Hocevar wrote:
>    Underfined weak symbols make it impossible to prelink a binary
> because those symbols are only resolved at runtime. Also, you
> cannot strip symbols from the main executable. And it is also not
> possible to make real library wrappers: if I create a libfoo library
> that links against allegro, I have to link the final program with
> -lalleg_unsharable even if it only uses symbols from libfoo and not
> allegro.
> 
>    I believe it is much cleaner to have an allegro_set_icon() function
> in the API than to depend on the presence of an allegro_icon symbol in
> the main program.

I can add a set_window_icon() function anyway (in fact, I may), but this is 
currently not needed in Windows. I'd rather not have it more difficult to 
set the icon in X than it is in Windows.
The current code allows for the possibility that weak symbols are not 
available and will try to use a constructor function to point the (in that 
case) non-weak symbol allegro_icon to user supplied data.

In case you're wondering, the way this is currently done is through the 
xfixicon.sh script. It outputs a .c file given a source image (say, .xpm) 
that will re-define the weak allegro_icon to point to the (inlined) pixmap 
data if weak symbols can be used, or point it there using a constructor 
function if it cannot define a weak symbol but can use a constructor.

Would this be something that could cause a problem? If not, I can simply 
change the current scheme to always use a constructor function and never 
use a weak symbol.

Evert





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