Closed canaknesil closed 4 years ago
Not sure why but directly ccall "jl_error" works:
julia> cxx"""
void my_julia_error() {
$:(ccall("jl_error", Cvoid, (Cstring,), "This is the error."));
}
"""
true
julia> @cxx my_julia_error()
ERROR: This is the error.
Stacktrace:
[1] (::getfield(Main, Symbol("##7#8")))() at ./none:0
[2] macro expansion at /Users/gnimuc/.julia/dev/Cxx/src/codegen.jl:841 [inlined]
[3] cppcall(::Cxx.CxxCore.CxxInstance{1}, ::Cxx.CxxCore.CppNNS{Tuple{:my_julia_error}}) at /Users/gnimuc/.julia/dev/Cxx/src/codegen.jl:841
[4] top-level scope at none:0
This worked for me. Thank you.
I am trying to call Julia
Base.error
method from C++. The example in README.md works fine:But, when I replace
println
witherror
, I get this error: