I’m guessing I just have the signature wrong or something here? This is Julia 1.9.0 on Windows 11.
Trying to call the Win32 API EnumWindows.
By the error message, it appears to be something wrong with the callback.
using WinTypes: HWND, LPARAM, BOOL
cb(hwnd, code)::BOOL = ( @show hwnd code ; return true )
function test()
cbc = @cfunction(cb, BOOL, (Ref{HWND}, Ref{LPARAM}))
@ccall "User32".EnumWindows(cbc::Ptr{Cvoid}, 1::LPARAM)::BOOL
end
Running the test() function results in the Julia process crashing with this output:
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x2087ac90891 -- unknown function (ip: 000002087ac90891)
in expression starting at REPL[2]:1
unknown function (ip: 000002087ac90891)
EnumChildWindows at C:\WINDOWS\System32\USER32.dll (unknown line)
EnumWindows at C:\WINDOWS\System32\USER32.dll (unknown line)
test at c:\data\julia\Automate\src\Automate.jl:8
unknown function (ip: 000002087ac907e3)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
do_call at C:/workdir/src\interpreter.c:126
eval_value at C:/workdir/src\interpreter.c:226
eval_stmt_value at C:/workdir/src\interpreter.c:177 [inlined]
eval_body at C:/workdir/src\interpreter.c:624
jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:762
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:912
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:856
ijl_toplevel_eval at C:/workdir/src\toplevel.c:921 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:971
eval at .\boot.jl:370 [inlined]
eval_user_input at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:153
repl_backend_loop at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:249
#start_repl_backend#46 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:234
start_repl_backend at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:231
#run_repl#59 at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:379
run_repl at C:\workdir\usr\share\julia\stdlib\v1.9\REPL\src\REPL.jl:365
jfptr_run_repl_62761.clone_1 at C:\app\dev\Julia\lib\julia\sys.dll (unknown line)
#1017 at .\client.jl:421
jfptr_YY.1017_37145.clone_1 at C:\app\dev\Julia\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
jl_f__call_latest at C:/workdir/src\builtins.c:774
#invokelatest#2 at .\essentials.jl:816 [inlined]
invokelatest at .\essentials.jl:813 [inlined]
run_main_repl at .\client.jl:405
exec_options at .\client.jl:322
_start at .\client.jl:522
jfptr__start_34279.clone_1 at C:\app\dev\Julia\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
true_main at C:/workdir/src\jlapi.c:573
jl_repl_entrypoint at C:/workdir/src\jlapi.c:717
mainCRTStartup at C:/workdir/cli\loader_exe.c:59
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 1025327 (Pool: 1025284; Big: 43); GC: 1