Toying around a bit with your code it seems square_array
is never actually called. Checking for an exception directly after the jl_call()
reveals a MethodError is raised. This is likely due to the fact that the x
argument being passed is an Array{Float64,1}
and not a Ptr{Cdouble}
(although I don’t know the details of whether that can be made to work when embedding).
Updating the signature of square_array
to use x::Vector{Float64}
makes the function get called, but array_wrap
is then unknown, but is also no longer needed as you can modify the array directly and it will get updated on the C++ side as well.