Library writing - delegates or fp's?

Don Clugston dac at nospam.com.au
Wed Jul 19 23:56:04 PDT 2006


BCS wrote:
> Chad J wrote:
>> So I have decided to roll my own GUI library, one dedicated to 
>> computer games.  But I've run into a bit of an unpleasant design 
>> problem - for handling callbacks, how should my library expose 
>> function pointers and delegates?
>>
> [...]
> 
> a while back someone found out that you can take a delegate and replace 
> the internal function pointer with a regular function pointer and it 
> still works just fine. 

It works fine *most of the time*. IIRC, sometimes it will result in 
incorrect code. We could deal with those cases if we knew the exact 
circumstances under which function parameters are passed in registers. 
But until the ABI gets formalised, it's a non-portable hack that 
occasionally fails.



More information about the Digitalmars-d-learn mailing list