
Hello All,
A newbie question regarding the C API. What is the pointer ownership convention, and where could I find tiny examples or tests of the C API of PPL?
So, I made a ppl_Coefficient_t (let's call it k) using ppl_new_Coefficient_from_mpz_t. [BTW, perhaps a ppl_new_Coefficient_from_long_long or a ppl_new_Coefficient_from_int32 might be useful]
Then I am filling a ppl_Linear_Expression_t (let's call it l) using ppl_Linear_Expression_add_to_coefficient with the same coeffiient k.
Should I explicitly delete by calling ppl_delete_Coefficient(k), or is k now "owned" by l and not available anymore?
Could I use twice the same k in different calls to ppl_Linear_Expression_add_to_coefficient?
I would suppose that PPL use a refcounting scheme as its memory management (or garbage collection) scheme. Is it correct? Who/when are the refcounters incremented & decremented? Is there a C API to e.g. force incrementation of the refcounter (like GTK has)?
BTW, a more general question is about the philosophy of memory management in PPL, especially when interfacing PPL to some language. Since my GCC MELT can be percieved as some language (the MELT lisp dialect) with its runtime (the MELT garbage collector, above the GGC inside GCC), I could view the interfacing of PPL inside MELT as a language binding of PPL.
In particular, detailed explanation of Ocaml binding to PPL is welcome, since I happen to know quite well Ocaml (and the C coding rules required by its runtime).
Again, apologies for asking such questions (whose answers are probably inside PPL source code).
Regards