Csdp
Csdp copied to clipboard
Refactory readprob with functions usable for Julia wrapper
It is currently quite difficult to use CSDP from another language as there is no API to play with the structures. In Julia, we mirrored the C-structures and modify them in Julia, see
- https://github.com/JuliaOpt/CSDP.jl/blob/master/src/blockmat.h.jl
- https://github.com/JuliaOpt/CSDP.jl/blob/master/src/blockmat.jl but this is quite tricky to make sure that the Julia GC does not free the memory used by CSDP and vice versa. This is most probably the reason CSDP now often segfaults: https://github.com/JuliaOpt/CSDP.jl/issues/39.
This PR adds an API in lib/julia.c that can be used by the Julia wrapper. The file readprob.c has been refactoried on top of the API.
The file julia.c is heavily inspired from readprob.c to make sure that the behavior of readprob.c does not change and that this PR does not break anyone's code.
The API in lib/julia.c could also be used by C users or wrappers from other languages, nothing is specific to Julia. We could rename it lib/api.c if you prefer.
Anything I could do to help this PR move forward ?