CImGui.jl
CImGui.jl copied to clipboard
Upgrading Guide: 1.79 to 1.82
Functions that return an object in 1.79 will return Ptr type in 1.82, please use unsafe_load to explicitly copy the object in your old code base.
For example, igGetIO() returns a pointer of type Ptr{ImGuiIO} in 1.82.
With this field access method in 1.79, say we have io::Ptr{ImGuiIO}=igGetIO(), then we can run ds = io.DisplaySize to get an object ds of type ImVec2.
The new field access method generated by Clang.jl now returns a pointer(in the above example, Ptr{ImVec2}) instead of an object(in the above example, ImVec2).
We are making this change because we want a small memory footprint and chaining support:
io.DisplaySize.x will now return a pointer and we can explicitly write unsafe_load(io.DisplaySize.x) to copy the value. In this case, only the value x is copied from C to Julia, not the whole object io.DisplaySize.
In 1.82, it will be a lot easier to read/load/copy a single value from a big nested struct without copying the whole struct object from C to Julia.