Re: [AD] Addons and al_free and non-public functions

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


On Wed, 2010-05-19 at 14:11 -0400, Pavel Sountsov wrote:
> I'm a little confused about when to use al_free/al_malloc and the 
> non-existent al_realloc (can someone add it in?) in the addons. Should 
> addons use those functions preferentially? How about the core, should 
> it use those instead of _AL_MALLOC and the like?

[not replying to that as I don't know]

> Also, when I was removing ALLEGRO_PRIM_COLOR I noticed that I had to 
> use  the  _al_add_exit_func function, which is naturally not a part of 
> the public API. I copied this usage from the font addon, and I'm sure 
> many other addons have something like this too. What's our policy about 
> using these non-public API functions in the addons? Should we just make 
> many of those functions public? Or perhaps because these addons are 
> bundled, they get special privileges? I also thought that using the 
> non-public API resulted in issues with dynamic libraries (since the 
> non-public API's are not wrapped in the magic macro).
> 

Some of the _al_ functions *are* public I'd say. They just are not part
of the API but are instead internal functions. I'd say there are 4 kinds
of functions in Allegro:

1. Public API functions - those correspond 1:1 to the functions starting
with al_.

2. Public internal functions - they are exported from DLLs and they all
start with _al_.

3. Non-public internal functions - they are not exported from DLLs and
they all start with _al.

4. Static functions. The only difference to type 3 functions is that
they are used in a single source file only so there's no need to declare
them in a header.

In A4 the internal API (type 2 functions) was quite extensive and many
things could only be done by using it. In A5 it seems we could get by
largely if we don't have an internal API - I'm not sure how big of a
benefit it would be though. E.g. things like the vector implementation
make sense as an internal DLL-exported API which can be used by addons
and user code if the implications are clear to whoever is using them.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





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