Frontend and backend communication

Dainius (GreatEmerald) pastas4 at gmail.com
Tue Oct 18 21:48:07 PDT 2011


I'm trying to implement the function pointer system right now, and it
seems to work on the C side, but not D. I assume I'm missing some kind
of syntax here. I have these global variables:

        struct S_FrontendFunctions {
            void function() RedrawScreen;
            void function(const char*, int) PrecacheCard;
        }
        shared S_FrontendFunctions FrontendFunctions;

And if I try to set the pointers D style, like this:

        FrontendFunctions.RedrawScreen = function(){};
        FrontendFunctions.PrecacheCard = function(const char*, int){};

I get errors:

        Error: cannot implicitly convert expression (__funcliteral3)
of type _error_ function() to shared(void function())
        Error: cannot implicitly convert expression (__funcliteral4)
of type _error_ function(const const(char*), int) to shared(void
function(const const(char*), int))

So how do I define those functions as shared?


More information about the Digitalmars-d-learn mailing list