Scoped external function declaration

novice2 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 1 09:51:45 PST 2015


I want to use external or C function.
It used only one time from one D function.
I want do declare C function inside D function.
I don't want to declare C function in global scope.

Is my wish correct?
Reduced code:



extern (C) int getch();
void main() {
   getch();
}
//compiled OK



void main() {
   extern (C) int getch();
   getch();
}
//Error 42: Symbol Undefined __D4test4mainFZ5getchUZi


More information about the Digitalmars-d-learn mailing list