Here’s a minimal example:
julia> mutable struct FILE
end
julia> outfile = ccall((:open, "libc"), Ptr{FILE}, (Cstring, Cstring), "test", "w+")
Ptr{FILE} @0xffffffffffffffff
julia> ccall((:fprintf, "libc"), Cuint, (Ptr{FILE}, Cstring), outfile, "write something")
signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
flockfile at /usr/lib/system/libsystem_c.dylib (unknown line)
vfprintf_l at /usr/lib/system/libsystem_c.dylib (unknown line)
fprintf at /usr/lib/system/libsystem_c.dylib (unknown line)
anonymous at ./<missing> (unknown line)
jl_call_fptr_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:339 [inlined]
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia_internal.h:358 [inlined]
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:589
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/builtins.c:496
eval at ./boot.jl:235
jlcall_eval_17976 at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
eval_user_input at ./REPL.jl:66
jlcall_eval_user_input_20272 at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
macro expansion at ./REPL.jl:97 [inlined]
#1 at ./event.jl:73
unknown function (ip: 0x11c63492f)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1424 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:267
Allocations: 1110321 (Pool: 1109185; Big: 1136); GC: 0
Segmentation fault: 11
It’s Julia 0.6 x86_64-apple-darwin13.4.0 release and this is run on macOS Sierra.
Does anyone know what might cause this and if there is a workaround for it? Thanks!