Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error on Julia 0.4-rel #1

Closed
Petr-Hlavenka opened this issue Nov 2, 2015 · 1 comment
Closed

Runtime error on Julia 0.4-rel #1

Petr-Hlavenka opened this issue Nov 2, 2015 · 1 comment

Comments

@Petr-Hlavenka
Copy link
Contributor

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

@bjarthur
Copy link
Collaborator

fixed in 5fd30b5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants