delegates/lambas do not pick up calling convention
    ag0aep6g via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Aug 10 02:46:43 PDT 2017
    
    
  
On 08/10/2017 01:52 AM, Johnson Jones wrote:
> I've tried
> 
>                                              import gdk.Threads;
>                                                  alias DD = static 
> extern(C) int delegate(void*);
>                                                  auto x = (void*)
>                                                  {
>                                                      return 1;
>                                                  };
>                                                  
> gdk.Threads.threadsAddIdle(x, null);
1) You probably meant to apply `DD` to `x`.
2) `x` must be a `function`, not a `delegate`.
3) (optional) `static` is not needed.
So:
----
import gdk.Threads;
alias DD = extern(C) int function(void*);
DD x = (void*)
{
     return 1;
};
gdk.Threads.threadsAddIdle(x, null);
----
    
    
More information about the Digitalmars-d-learn
mailing list