Using ccall and pointer to pointer in linked list

Thanks, @tomaklutfu. Indeed it shouldn’t be NULL.

The following worked:


list_ref = Ref{Ptr{Node}}()

ccall((:add_to_list, LIBLIST), Cvoid, (Ptr{Ptr{Node}}, Cint), list_ref, 10)
ccall((:add_to_list, LIBLIST), Cvoid, (Ptr{Ptr{Node}}, Cint), list_ref, 20)

list = unsafe_load(list_ref[])
@show list.value # 20

This comment was helpful.