Open yjiangnan opened 6 years ago
The problem magically disappeared a few days later automatically, maybe because of Mac OSX crashing and restarting. However, another problem occurred when I followed the example:
julia> cxxinclude("ArrayMaker.h")
julia> maker = @cxxnew ArrayMaker(5, 2.0)
Got arguments: 5, and 2
(class ArrayMaker *) @0x00007fee908c9670
julia> arr = @cxx maker->fillArr()
Filling the array
Ptr{Float32} @0x00007fee90865290
julia> pointer_to_array(arr, 5)
ERROR: UndefVarError: pointer_to_array not defined
Stacktrace:
[1] macro expansion at /Applications/JuliaPro-0.6.4.1.app/Contents/Resources/pkgs-0.6.4.1/v0.6/Atom/src/repl.jl:118 [inlined]
[2] anonymous at ./<missing>:?
julia> arr
Ptr{Float32} @0x00007fee90865290
julia> pointer_to_array(arr, 5)
ERROR: UndefVarError: pointer_to_array not defined
Stacktrace:
[1] macro expansion at /Applications/JuliaPro-0.6.4.1.app/Contents/Resources/pkgs-0.6.4.1/v0.6/Atom/src/repl.jl:118 [inlined]
[2] anonymous at ./<missing>:?
julia> pointer
pointer (generic function with 20 methods)
julia> parentindexes
parentindexes (generic function with 3 methods)
How can a builtin function not be defined?
pointer_to_array
is an old function; the documentation here is simply out of date. The function was deprecated in Julia 0.5 and removed in Julia 0.6. It should now be unsafe_wrap(Array, arr, 5)
.
@ararslan Great! Thanks for the info. It seems that the Julia community is still really tiny, though. Very basic things could fail without clear reasons and documentations are either scarce or out of date.
I installed the recent Cxx.jl master branch on MacOS by Pkg.checkout("Cxx") and Pkg.build("Cxx").
Following "Example 8: Using C++ with shared libraries" on https://github.com/Keno/Cxx.jl, I get errors:
"ArrayMaker.h" is in the current directory.
How can this problem be solved?