The documentation for Ref
says
When passed as a ccall argument (either as a Ptr or Ref type), a Ref object will be converted to a native pointer to the data it
references. For most T, or when converted to a Ptr{Cvoid}, this is a pointer to the object data. When T is an isbits type, this
value may be safely mutated, otherwise mutation is strictly undefined behavior.
does this mean one should not pass a mutable struct to a ccall function ?
@ccall "libfoo".baz( a1 :: Ref{MutableStruct}) ::Cvoid
if void baz( Cstruct *a1)
does something like a1->f++
inside it ?
does this also mean in general its unsafe to pass mutable structs to shared libraries until one is 100% sure of the function implementation and the structs dont get mutated by the library ?