fromStringz problem with gdc

chardetm via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 6 10:47:25 PDT 2015


Hello everyone,

I have a problem with the fromStringz function 
(std.string.fromStringz) when I try to compile with the GDC 
compiler (it works fine with DMD).

Here is a minimal code to see the error:


import std.stdio, std.string, std.c.stdlib;

int main () {
     char* s;
     s = cast(char*) malloc(2);
     s[0] = 'a';
     s[1] = '\0';
     writeln(fromStringz(s));
     return 0;
}


Compiling with DMD (works fine):
$ dmd testfsz.d

Compiling with GDC:
$ gdc testfsz.d -o testfsz
testfsz.d:8: error: undefined identifier fromStringz

It does the same thing on a friend's computer. I'm using GCC 
4.9.1 on Kubuntu 14.10.
Any idea where this comes from? Thanks in advance for your help!


More information about the Digitalmars-d-learn mailing list