Following the embedding guide, I’m getting a crash when attempting to retrieve the results of an exception. This is the generic handler code (it is not C):
*ex= jl_eval_string(code)
If jl_exception_occurred()
sptr = jl_typeof_str(jl_exception_occurred())
after which sptr (pointer to the string result) is displayed.
This works if code is something like “sqrt()” (returns method error
, as expected), but crashes on the call to jl_exception_occurred()
if the input to eval is this:
function pb_test_add(a,b)
a+b
end
This doesn’t cause any exception when executed in the REPL.
Note: I’ve also tried this version of exception message capture:
If jl_exception_occurred()
sptr = jl_string_ptr(jl_eval_string("sprint(showerror, ccall(:jl_exception_occurred, Any, ()))"))
which works elsewhere, but is never reached due to the first crash.
Thoughts?
Here’s the system stack dump (on Windows, so if someone knows a better way to get the details, let me know…)
0000007d`246fee58 00007ffe`d445c79e : ffffffff`ffffffff 00000000`00000000 00000000`00000003 00000000`00000910 : ntdll!NtTerminateProcess+0x14
0000007d`246fee60 00007ffe`d29218ab : 00000000`00000003 0000007d`246ff050 00000000`00000000 00000000`00000000 : ntdll!RtlExitUserProcess+0x11e
0000007d`246fee90 00007ffe`d29ee2c9 : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`00000000 : kernel32!ExitProcessImplementation+0xb
0000007d`246feec0 00007ffe`d29ee914 : 00000000`00000001 00007ffd`f5b1d5ae 0000022b`45ad00b0 00000000`00000001 : msvcrt!_crtExitProcess+0x15
0000007d`246feef0 00007ffe`d29dec4c : 00000000`00000016 00000000`00000000 00007ffd`00000000 00000000`00006941 : msvcrt!doexit+0x170
0000007d`246fef60 00007ffd`f5b27bb6 : 00000000`00000001 00000000`00000000 00000000`00000016 0000007d`246feff0 : msvcrt!raise+0x24c
0000007d`246fefd0 00007ffe`d29dec11 : 00000000`00000016 00007ffd`00000000 00000000`00000302 00000000`00000016 : libjulia_internal!crt_sig_handler+0x56
0000007d`246ff4e0 00007ffe`d29e305b : 0000007d`00000001 00007ffd`00000000 00007ffd`e26aeb30 00007ffd`e26aec5f : msvcrt!raise+0x211
0000007d`246ff550 00007ffd`f5c8b69b : 00000000`0000004c 00000000`00000000 00000000`00000000 00000000`00000000 : msvcrt!abort+0x1b
0000007d`246ffb00 00007ffd`f5ac705a : 00007ffd`e26aeb30 00007ffd`f5ac68f0 0000022b`461a7388 00007ffd`e262c8a0 : libjulia_internal!jl_smallintset_lookup+0x1d961b
0000007d`246ffba0 00007ffd`f5ac9322 : 0000007d`246ffcb0 0000022b`461a7388 00007ffd`f5dbfe40 00007ff7`21ac205e : libjulia_internal!jl_get_module_binding+0x7a
0000007d`246ffc70 00007ff7`21ae858e : 00000000`00000001 00000000`00000000 00000000`00000000 00007ff7`00000004 : libjulia_internal!ijl_get_global+0x22