JaneliaSciComp/NIDAQ.jl

Runtime error on Julia 0.4-rel

Closed this issue · 1 comments

The Pkg.test("NIDAQ") is failing on the first lines of test code.
On the 4th line of runtest.jl the call to

    d = devices()[1]

the error is

ERROR: LoadError: MethodError: `convert` has no method matching convert(::Type{P
tr{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<:Union{Int8,UInt8}}(::Type{Ptr{T<:Union{Int8,UInt8}}}, ::Cstring)   
  convert{T}(::Type{Ptr{T}}, ::UInt64)                                          
  ...                                                                           
 in devices at c:\Users\phlavenk\JuliaData\v0.4\NIDAQ\src\properties.jl:5       
 in include at boot.jl:261                                                      
 in include_from_node1 at loading.jl:304                                        
 in process_options at client.jl:308                                            
 in _start at client.jl:411                                                     
while loading c:\Users\phlavenk\JuliaData\v0.4\NIDAQ\test\runtests.jl, in expres
sion starting on line 4                                                         
================================[ ERROR: NIDAQ ]================================

The devices() function is defined in properties.jl code as:

    function devices()
        println("Here devices")
        sz = GetSysDevNames(convert(Ptr{UInt8},C_NULL), UInt32(0))
        data=zeros(UInt8,sz)
        catch_error(GetSysDevNames(convert(Ptr{UInt8}, data), UInt32(sz)))
        map((x)->convert(ASCIIString,x), split(chop(string(char(data)...)),", "))
    end

The problem is in the convert(Ptr{UInt8}, data) part to obtain the UInt8 pointer to array to pass to a function GetSysDevNames generated by Clang.jl
interestingly, if I execute this function line-by-line on the REPL the conversion runs just fine.

Could you please help me to fix this pointer conversion on 0.4.0?
Thanks a lot.

Petr

fixed in 5fd30b5