Extern Keyword for Function Type

Artur Skawina art.08.09 at gmail.com
Tue Apr 15 15:31:56 PDT 2014


On 04/15/14 22:15, Jeroen Bollen wrote:
> exten(C) {
>     testFunction(int function(int));
> }
> 
> testFunction now requires an external function as parameter. It can't be called with a pointer to a D function.
> 
> Logical Solution:
> 
> extern(C) {
>     testFunction(extern(D) int function(int)); // DOES NOT COMPILE
> }
> 
> How do you fix this without moving it outside the global extern block?

   extern(C) {
       extern (D) alias FP = int function(int);
       void testFunction(FP);
   }

artur


More information about the Digitalmars-d-learn mailing list