I use ldc2 main.d -L-lcurses or dmd main.d -L-lcurses and following source code: import std.stdio; extern(C) int tgetnum(const(char) *id); int main() { writeln(tgetnum("li")); return 0; } Note that you don't need to apply toStringz to string literals since they implicitly cast to const char*.