Re: [AD] AL_ prefix clashes with OpenAL

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


On Sunday 08 July 2007 06:19:58 am Ryan Patterson wrote:
> Right, and it would have to do two. The first to get the address of
> the stub function and calling it which gets the address of the actual
> function and calls it.

How do you figure? A function pointer that's loaded via dlsym/GetProcAddress 
would just make the pointer explicit, instead of implicit by the system. The 
address of the function is already known by the time it's requested, so it 
just returns that. It wouldn't make it a pointer-to-a-pointer.

What I believe would happen is something like this:

normal: blit is unknown at link time, so is called via a (hidden) dereferenced 
pointer, such as __imp_blit or something, which is filled implicitly at load 
time. Calls to blit(...) become (*__imp_blit)(...), and the system does
__imp_blit = GetProcAddress(NULL, "blit");
before your code is run.

explicit: al.blit is a normal pointer, and calls to the function dereference 
it as such (al.blit(...) implies (*al.blit)(...)). At run time, an inline 
function gets the known address of allegro_blit and explicitly sets the 
pointer. You set
al.blit = GetProcAddress(NULL, "allegro_blit");
before using the function.

The only difference is, one pointer is set implicitly at load time and the 
other is set explicitly at run time.




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