Cxx.jl icon indicating copy to clipboard operation
Cxx.jl copied to clipboard

No method for unsafe_load(::Cxx.CppRef{Cxx.CxxArrayType{UInt64},(false, false, false)})

Open maxruby opened this issue 7 years ago • 0 comments

System: MacOS 10.12.3. Julia: 0.6.0-pre.alpha.49, master/eca966c Description: After successfully installingCxx.jl and updating OpenCV.jl I ran into a MethodError every time I invoked OpenCV.jl image Mat or similar constructors in the REPL. From the errors below, it seems that unsafe_load of Cxx.CppRef{Cxx.CxxArrayType{UInt64},(false, false, false)} is not supported - and thus the value cannot be displayed by Base.show?

Commenting out push!(ret.args,:(print(io,unsafe_load(x)))) in show.jl eliminates the ugly error display, but obviously it is not the solution.

julia> using OpenCV
WARNING: requiring "OpenCV" in module "Main" did not define a corresponding module.

julia> img0 = Mat(500, 500, CV_8UC3)
(class cv::Mat) {
 .flags = (int &) 1124024336
 .dims = (int &) 2
 .rows = (int &) 500
 .cols = (int &) 500
 .data = (char *&) Ptr{UInt8} @0x0000000335d9b020
 .datastart = (char *&) Ptr{UInt8} @0x0000000335d9b020
 .dataend = (char *&) Ptr{UInt8} @0x0000000335e521d0
 .datalimit = (char *&) Ptr{UInt8} @0x0000000335e521d0
 .allocator = (class cv::MatAllocator *&) (class cv::MatAllocator *) @0x0000000000000000

 .u = (struct cv::UMatData *&) (struct cv::UMatData *) @0x00007fa5f1593d10

 .size = (struct cv::MatSize &) {
 .p = (int *&) Ptr{Int32} @0x000000011c3bdd68
}

 .step = (struct cv::MatStep &) {
 .p = (unsigned long *&) Ptr{UInt64} @0x000000011c3bddb0
 .buf = (unsigned long (&)[]) Error showing value of type Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}:
ERROR: MethodError: no method matching unsafe_load(::Cxx.CppRef{Cxx.CxxArrayType{UInt64},(false, false, false)})
Closest candidates are:
  unsafe_load(::Ptr) at pointer.jl:83
  unsafe_load(::Ptr, ::Integer) at pointer.jl:83
  unsafe_load(::Cxx.CppRef{T<:Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, Ptr, UInt16, UInt32, UInt64, UInt8},CVR} where CVR) where T<:Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, Ptr, UInt16, UInt32, UInt64, UInt8} at /Users/Max/.julia/v0.6/Cxx/src/cxxtypes.jl:108
  ...
Stacktrace:
 [1] show(::IOContext{Base.Terminals.TTYTerminal}, ::Cxx.CppRef{Cxx.CppBaseType{Symbol("cv::MatStep")},(false, false, false)}) at /Users/Max/.julia/v0.6/Cxx/src/show.jl:9 (repeats 2 times)
 [2] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./REPL.jl:122
 [3] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./REPL.jl:125
 [4] display(::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./multimedia.jl:194

maxruby avatar Mar 05 '17 06:03 maxruby