Open lundmark opened 5 years ago
As a workaround/solution you could actually embedded the tld-parser and add types via txt... That might be the easiest solution right now?
See dl_context_load_txt_type_library() in dl_typelib.h
I'm not sure that I want to maintain another API as the above exists. Adding one more API would make it more work and more testing to add features + 2 ways to do the same thing. Does that make sense?
Well, I thought it would be nice to have a common interface that both dl_typelib_read_txt and dl_typelib_read_bin uses. That way it could be exposed externally and used for other things. I mean sure it would be possible to generate a dl-text lib file and then load that one - but that really feels like a hack.
How else would you propose for someone to implement a c-header-parser that generates a dl-typelib from that?
They could use the txtfmt as well ;) Jokes aside I think it would be quite a refactoring but I'll have a look...
I'm not sure I understand why it would be simpler to interact with DL types via a C API than it is via the JSON format?
I would vote against this, but that might be because I don't understand the problem.
Creating a C-header-parser which generates a json file from that sounds trivial. Interpretation of the C-header is the hard part, not expressing dl-types in json.
It would be really sweet if we could have an api for manually adding types/structs etc to a type library. That would allow the functionality for creating custom parsers more easily.