[OT] Re: toStringz or not toStringz

SimonM user at example.net
Fri Jul 8 07:03:53 PDT 2011


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.
>
> -Steve



More information about the Digitalmars-d mailing list