Frontend and backend communication

Kai Meyer kai at unixlords.com
Thu Jul 28 12:39:55 PDT 2011


On 07/28/2011 01:18 AM, Dainius (GreatEmerald) wrote:
> Hmm, there are still a whole lot of functions that call Shuffle(), so
> it might not be ideal. However, this gives me an idea - if a pointer
> to a function can be a parameter, can it be a global variable? In that
> case, the frontend would indeed be able to overwrite the function that
> the backend calls by simply altering that pointer.

Yes, you could create a "function table" and keep a list of all the 
functions that need to be called. You can then alter the behavior of one 
method at runtime with out having to pass a function as a parameter. Of 
course, global variables are tricky things, especially whe you're 
threaded. It's probably simplest to just pass the function pointer as a 
parameter to Shuffle(). If Shuffle() indeed has multiple entry points, 
and they all fight to have their version of PlaySound() run at the end 
of Shuffle(), then you may run into problems.

-Kai Meyer


More information about the Digitalmars-d-learn mailing list