On Wednesday, May 14, 2014 8:26:11 PM UTC-4, Samuel Colvin wrote: > > Ok now I'm really confused an I can see why a using Char pointers should > work, but when i make that change the the julia object being editted (and > passed back and forth between julia and c) get s messed up: all the strings > are random characters. >
Ptr{Char} or Ptr{Int32} both work for me: s = utf32("Hello") si = reinterpret(Int32, copy(s.data)) UTF32String(pointer_to_array(pointer(s.data), length(s))), UTF32String(pointer_to_array(pointer(si), length(s))) gives ("Hello","Hello"). Maybe the problem is that the Ptr{Char} version is not making a copy of the data, and C is overwriting or freeing the buffer before you examine the string?