Call C function - Access violation

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 3 12:32:30 PST 2016


>
> Use an import.
>
> import std.string;
> import std.conv;
>
> void main(string[] args) {
>     auto value  = toStringz("Hello World");
>     auto result = write(value);
>     auto s      = to!(string)(result);
>     writeln(s);
> }
>
> Also all string literals in D are zero terminated so you could 
> write the call like this:
>
> auto result = write("Hello World");

Okay, thank you very much!

But now i get the access violation error again.

If i type:
gcc -c -otest.c.o

the 'test.c.o' file is generated but if i type:

dmd main.d test.c.o i get: 'Error: unrecognized file extension o'?


More information about the Digitalmars-d-learn mailing list