tinyspline icon indicating copy to clipboard operation
tinyspline copied to clipboard

parson conflicts with json-c library

Open bog-dan-ro opened this issue 1 year ago • 3 comments

I'm trying to use tinyspline with other libs which depend on json-c library, but I fail to link them because parson & json-c are using the same functions names. Is it possible to make JSON suport optional or rename parson's function or somehow hide them ?

bog-dan-ro avatar Sep 13 '22 06:09 bog-dan-ro

Could you please name the affected functions? The easiest solution is to rename them (for example by adding the prefix ts_). In the long run, I would like to replace parson with a custom implementation anyways.

msteinbeck avatar Sep 13 '22 17:09 msteinbeck

I think all json_* functions used by ts are clashing with json-c library. IMHO a new compilation flag is better as most of the people that are using TS in combination with JSON will use their own library. Adding JSON parser/writer inside TS will duplicate the code size for JSON ...

bog-dan-ro avatar Sep 14 '22 09:09 bog-dan-ro

as most of the people that are using TS in combination with JSON will use their own library.

The same could be true with, for example, TinySpline's vector functions. Yet, I would like to avoid adding various compilation flags to enable or disable certain features. As I said, in the long run I would like to implement JSON serialization directly in TinySpline.

Adding JSON parser/writer inside TS will duplicate the code size for JSON

TinySpline's JSON parser would only need a very small subset of general JSON parser libraries. For example, only numbers and array of numbers are needed. Generating JSON should be really easy. Parsing JSON requires some error handling. However, the amount of code should be quite small.

msteinbeck avatar Sep 16 '22 15:09 msteinbeck