Am I doing it wrong or is this a bug ?

Ezneh petitv.isat at gmail.com
Thu Aug 12 07:34:03 PDT 2010


Mafi Wrote:

> Hi,
> returning an int works because D's int and most other language's (eg 
> C's) int are identical. D's string is an alias for 'immutable(char)[]'. 
> The brackets [] idicate an D array. D arrays are not the same as C 
> arrays. In C strings are char* pointing to a null terminated sequence of 
> chars. In D they are more complicated.
> Just let your function return char* replace 'return xy;' with 'return 
> toStringz(xy);'. Then put 'import std.string' at the begining of your 
> file. Then you do this your function will return c-like strings for 
> interfacing with C and C++.


Thanks ! It works well :-), and for integers (other message), I didn't replace the DLL so I got wrong value.

I think I should learn phobos and druntime libraries before asking something like that.


Ok, there's no problem now.


More information about the Digitalmars-d mailing list