Ok, the "UTF32String(pointer_to_array(key, key_length, false))" method didn't work because the pointer was still Uint8, but when i changed it to be Int32 it worked.
So in summary i ended up with
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
Working.
Thanks for the advice.
