Re: [AD] font vtable patch

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


On Monday 30 April 2001 11:54, you wrote:

> > A wrapper around ``blessed'' internals?
> >
> >     void *allegro_get_internal(AL_CONST char *key);
>
> I like the idea of some sort of a wrapper. With such a scheme, we could
> export only the regular API symbols plus this single one. The question is
> then which kind of dynamic linking we would use to implement it ?
>
> Either run-time linking as you are suggesting: the program must query
> Allegro for each internal symbol it wants to use and work around the
> problem or terminate if the symbol is missing.
>
> Or load-time linking: we build up in the sources a table of all internals
> that we want to be exported and export only this table. Therefore we still
> have only the regular API symbols plus one, this latter being a variable
> rather than a function.
> An add-on calls a specific internal with the help of a macro:
>    if (AL_INTERNAL(_textmode) < 0)
>       /* render as transparent */
>    else
>       /* render as opaque */
>
> with somewhere in allegro.h:
>    #ifdef STATICLINK
>       #define AL_INTERNAL(symbol)  symbol
>    #else
>       #define AL_INTERNAL(symbol)  *(internals_table.##symbol)
>
> This solution seems to be lighter than the previous one, but of course less
> safe.

i vote for eric's method btw. for obvious reasons.

-- 
Sincerely Henrik Stokseth.
----------------------------------------------------------------------------
E-mail: hstokset@xxxxxxxxxx  Homepage: http://hstokset.n3.net
"Linux is keyboard friendly. I don't smash it like I used to with Windows."



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