[OT] Re: toStringz or not toStringz

Jonathan M Davis jmdavisProg at gmx.com
Fri Jul 8 09:12:25 PDT 2011


On 2011-07-08 07:03, SimonM wrote:
> This is kind of off-topic, and I don't know if it's just me, but I've
> barely been able to use toStringz() where it's supposed to be useful:
> 
> I tried using it with a C function whose parameters are not
> const(char)*, but just char*, but because it returns immutable(char)'s I
> had to write my own one.
> 
> I tried using it with a C function that's unicode, but it won't take
> wstring's as arguments... so I had to write my own one.
> 
> Maybe it's because I'm not really experienced with interfacing to C code
> from D, or maybe it's because I couldn't write the extern(C) code myself
> as I'm using someone else's C interface, but out of the 3 times I tried
> using it in the last day, it only helped once.
> 
> On 2011/07/08 15:48 PM, Steven Schveighoffer wrote:
> > I personally think, barring this idea, the best path is simply to wrap C
> > functions you want to call with toStringz'd versions.

https://github.com/D-Programming-Language/phobos/pull/123

- Jonathan M Davis


More information about the Digitalmars-d mailing list