It's exactly what I was trying to point out. That example (that i
found inside tarball!) is wrong... And using D as plain C-Wrapper
it's not fun...
On Tuesday, 26 June 2012 at 16:49:11 UTC, Dejan Lekic wrote:
xbuf_ncat is a C function, you can't give it a D string just
like that - you must use std.string.toStringz() ...
On Monday, 25 June 2012 at 13:42:39 UTC, Andrea Fontana wrote:
Using C plain api it's not a good way to use D power IMHO :)
xbuf_ncat(get_reply(argv), "Hello World (D)", "Hello World
(C)".sizeof - 1);
Probably this example doesn't work properly.
On my machine writeln("1234".sizeof); gives "16" because of
UTF-8.
So "1234".sizeof - 1 is 15.
AFAIK D strings are not null-terminated (are they?) and i
guess that line of code won't work.
Encapsulate code with classes/template/etc would be a good
idea.
On Monday, 25 June 2012 at 13:29:59 UTC, Eric R. Schulz
(ers35) wrote:
G-WAN exports a C API and D supports calling C functions.
In what way could G-WAN better support D?
Perhaps reading the G-WAN manual would help to explain:
http://gwan.ch/archives/gwan_linux.pdf
Maybe they should give a better support for D language...