alias and extern(C)

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 30 12:52:31 PDT 2014


On Thursday, 30 October 2014 at 18:43:21 UTC, Laeeth Isharc wrote:
> The code below works fine if you remove the extern(C).  But I 
> get the error "functionpointertest.d(6): Error: basic type 
> expected, not extern" with the code as it  is.
>
> How do I use alias with extern ?
[...]
> alias Callback= extern(C) void function(int);

Compiles as is with dmd 2.066. For 2.065 and older you have to
put extern(C) in front of "alias":

extern(C) alias Callback= void function(int);


More information about the Digitalmars-d-learn mailing list