Hello, I am learning Julia and reading the documentation.
There is this example:

function gethostname()
  hostname = Array(UInt8, 128)
  ccall( (:gethostname, "libc"), Int32,
        (Ptr{UInt8}, UInt),
        hostname, length(hostname))
  return bytestring(convert(Ptr{UInt8}, hostname))end

I get the following error when calling the function:

ERROR: MethodError: `convert` has no method matching 
convert(::Type{Ptr{UInt8}}, ::Array{UInt8,1})
This may have arisen from a call to the constructor Ptr{UInt8}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert{T}(::Type{Ptr{T}}, ::UInt64)
  convert{T}(::Type{Ptr{T}}, ::Int64)
  ...
 in eval at ./boot.jl:263


I am using julia Version 0.5.0-dev+1317. Anybody knows how to solve this 
problem? Thanks Martin

Reply via email to