On Thursday, November 20, 2014 5:37:22 PM UTC-5, Eric Davies wrote: > > (For context, I'm working on this issue: > https://github.com/JuliaOpt/ECOS.jl/issues/12 and dealing with these > structs: > https://github.com/JuliaOpt/ECOS.jl/blob/master/src/types.jl#L124-L216 ) > > I have a C struct used in a 3rd-party C library mirrored as an immutable > in Julia. A pointer to the C struct is returned in another C struct, and I > get the immutable using pointer_to_array(...)[1]. I want to be able to > modify fields of the struct in-place, but immutables disallow this. How do > I go about this? >
Why not just use pointer_to_array(...)[1] = ...new immutable..., or unsafe_store!(pointer-to-immutable, new immutable) to store a new struct (build from the old struct + modifications) in the old location?
