I am trying to propagate an error from C++ to Julia. From the Cxx.jl documentation, I found (which works fine):
julia> cxx"“”
void testJuliaPrint() {
$:(println(“\nTo end this test, press any key”)::Nothing);
}
“”"
Trying the same with the Julia error()
function:
julia> cxx"“”
void testJuliaError() {
$:(error(“ERROR”)::Nothing);
}
“”"
Results in (which I am not competent to interpret):
ERROR: Inferred Union or abstract type Union{} for return value of lambda
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] cpptype(::Cxx.CxxCore.ClangCompiler, ::Type{getfield(Main, Symbol(“##42#43”))}) typetranslation.jl:302
[3] ssv(::Cxx.CxxCore.ClangCompiler, ::Any, ::Cxx.CxxCore.CppPtr{Cxx.CxxCore.CxxQualType{Cxx.CxxCore.CppBaseType{Symbol(“clang::DeclContext”)},(false, false, false)},(false, false, false)}, ::Int64, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Dict{Nothing,Nothing}) cxxstr.jl:56
[4] ssv(::Cxx.CxxCore.ClangCompiler, ::Any, ::Cxx.CxxCore.CppPtr{Cxx.CxxCore.CxxQualType{Cxx.CxxCore.CppBaseType{Symbol(“clang::DeclContext”)},(false, false, false)},(false, false, false)}, ::Int64, ::Base.GenericIOBuffer{Array{UInt8,1}}) at cxxstr.jl:40
[5] top-level scope at cxxstr.jl:641
Actually, println()
is the only function I have found to be callable from C++. Any ideas how to propagate an error condition from C++ to Julia ?