type in extern declaration

NonNull non-null at use.startmail.com
Mon Sep 20 20:02:24 UTC 2021


How do I write the type of a function so as to alias it, and use 
that in an extern(C) declaration?

For example, how do I write the type of an external function

int main2(int argc, char** argv) {
     //
}

?

This is not

int function(int, char**)

because this is the type of a function pointer of the right type, 
not the type of the function itself.

If I had that type aliased to mainfunc I could write

extern(C) mainfunc main2;

in D source to arrange to call it, and similarly any other 
functions of the same type.



More information about the Digitalmars-d-learn mailing list