How to get stacktrace and line numbers after jl_exception_occurred?

I’m loading a string from a file and passing it to jl_eval_string. When there is an error in the file I can tell because jl_exception_occured() returns non-null. But how do I get a stack trace with line numbers from that exception object, for use in the C/C++ code?

auto result = jl_eval_string(code);
auto ex = jl_exception_occurred();
std::cout << "result: " << result << std::endl;
std::cout << "ex: " << ex << std::endl;
if (ex) {
        jl_static_show(jl_stderr_stream(), ex); 

That jl_static_show call prints:

ErrorException(“syntax: “w:Int64” is not a valid function argument name”)

That helps, but I’d like to get this info below, which I see if I include the file in the REPL:

julia> include("/Users/rob/Library/.../main.jl")
ERROR: LoadError: syntax: "w:Int64" is not a valid function argument name around /Users/rob/Library/Containers/.../main.jl:15
 [1] top-level scope
   @ ~/Library/Containers/.../main.jl:15
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [3] top-level scope
   @ REPL[10]:1
in expression starting at /Users/rob/Library/.../main.jl:15