I'm not sure.

Try __gshared string str = "a";

2011/10/1 Dainius (GreatEmerald) <past...@gmail.com>

> > However, this gets quite inefficient with a lot of different strings,
>
> I just had an idea, perhaps it's possible to work around this
> particular point by creating a wrapper function that converts the
> passed variable into the C string type? The problem with this idea is
> that I can't find a way to pass the variable to begin with. Whenever I
> try to do that, D receives an empty string. My C code is this:
>
>    extern char* str;
>    printf("string is %s\n", getString(str));
>
> While the D code is this:
>
>    shared string str="a";
>    extern(C) immutable(char)* getString(string MyString)
>    {
>       writeln("Attempting to convert ", MyString);
>       return toStringz(MyString);
>    }
>
> This results in "Attempting to convert ", and not "Attempting to
> convert a", so obviously D is not getting the right data. But it
> doesn't segfault, either.
>

Reply via email to