On Wednesday, May 14, 2014 7:57:49 PM UTC-4, Samuel Colvin wrote:

> function get_key(key_::Ptr{Int32}, key_length_::Ptr{Cint})
>     key_length = unsafe_load(key_length_)
>     UTF32String(pointer_to_array(key_, int64(key_length), false))
> end
>

Change it to Ptr{Char} (Char is 4 bytes) instead of Ptr{Int32}, in order to 
save yourself from making a copy of the data. 

Beware that this code may not be portable, if the C library you are using 
employs the wchar_t type.  If you want it to work on Windows, too, you may 
need to deal with UTF16 on that system.  (You could have two versions of 
the function, depending on sizeof(Cwchar_t).)

Reply via email to