Where are declared and how to make build these c identifiers?

Cleverson Casarin Uliana clul at mm.st
Sat Feb 23 21:10:19 UTC 2019


Hi all, I'm revisiting D after some years. I'd like to test a code 
snipped from RosettaCode, which is suposed to check a key press, as follows:

extern (C) {
     void _STI_conio();
     void _STD_conio();
     int kbhit();
     int getch();
}

void main() {
     _STI_conio();
     char c;
     if (kbhit())
         c = cast(char)getch();
     _STD_conio();
}

However, I'd like to know how all these functions really work, so I'd 
like to know where they are declared and/or defined. Since there are 
that extern (C) line at the beginning of the snippet, I assume them to 
be c code, so my question is, is there any kinda C library refference 
where I can find such declarations, similar to the Phobos library 
refference in D? In principle, I couldn't find e.g. _sti_conio by 
searching on Google.

In addition, I went to try building the code above with:
ldc2 -release -Os keypress.d
but received this error message:
lld-link: error: undefined symbol: _STI_conio
 >>> referenced by keypress.obj:(_Dmain)


lld-link: error: undefined symbol: _STD_conio
 >>> referenced by keypress.obj:(_Dmain)

Error: linking with LLD failed

As far as I recall, such kind of error indicates a library is missing on 
the command line. Does anyone know what it is please?

Thanks for your help,
Cleverson


More information about the Digitalmars-d-learn mailing list