Working on spidev.h and spidev.c translation

Keeping the object alive is another story, which is related by was what I was trying to do after making sure the right pointer is passed in the other thread.
Before worrying about GC safety, the main piece that’s missing here is to make the output parameter working. The only thing that needs to be done is to translate &obj->x1 or &x1 from C. Copying/modifying from the example in the other thread, you can do these with

x1 = Ref(obj.x1)
ccall(..., x1)
x1[]

and

ccall(..., pointer_from_objref(obj) + fieldoffset(typeof(obj), 1)))

Then see Properly using `finalizer`, `ccall`, `cconvert` and `unsafe_convert` - #10 by yuyichao for how to make the latter GC safe.

Other than special syntax from macros, whenever you have f(a) where f can be anything including ccall etc, it is impossible for it to modify the binding of a. It can only mutate a if a is mutable.