Language subset for printing

Adam D. Ruppe destructionator at gmail.com
Fri Dec 20 17:47:03 PST 2013


On Saturday, 21 December 2013 at 01:39:29 UTC, Casper Færgemand 
wrote:
> I take it that means it's intrinsic?

Not intrinsic, just an extern library function.

D can call any C function by copy/pasting the declaration and 
adding extern(C).


for example, on Linux, you can do:

extern(C) void write(int, char*, size_t);

void main() {
    write(1, "hello\n", 6);
}


and that will work too. Similarly, on Windows, you can do:

extern(Windows) int MessageBoxA(void*, const char*, const char*, 
int);

void main() {
    MessageBoxA(null, "hello", "message", 0);
}

and call operating system functions that way.


More information about the Digitalmars-d-learn mailing list