Exporting a String

Juan Ignacio García García jigg@ugr.es
Thu, 27 Sep 2001 19:57:13 +0200


hello,

Is there any way to export a value of type String?
I have tried it as follows

Haskell code
 foreign export f::Int -> IO (StablePtr String)
 f:: Int -> IO (StablePtr String)
 f n = newStablePtr ("hola")

C code
 char *cad;
 cad=f(5);
 printf("%s",cad);

but it does not go (segmentation fault).

Thanks in advance,

J. Ignacio García