On Thursday, 29 December 2011 at 20:08:45 UTC, bls wrote:
import std.stdio;
import std.functional;

int main(string[] argv)
{
        

        extern(Windows) int delegate( int i) dg;
        alias dg callback;

                        
                        callback = toDelegate(&test);

                        writeln( callback( 1 ) );
                        
                        readln();


return 0;
}

extern(Windows) int test(int i) { return 41 +i;}

hth, bjoern

Wow! This is actually pretty cool! I needed something similar, but it was to call a member function from the Windows procedure, and I had to use some thunking though assembly.

Maybe I can adapt my code to use a delegate like this instead.

Reply via email to