It's very nice that finally solutions that use libclang are showing up. That 
said, the way c2nim does it is fundamentally the best way:

c2nim is not only a (quirky) C parser, it knows about `.bycopy`, `.cdecl` and 
`.size: sizeof(cint)` for enums and never forgets these important annotations.

Yes, you need to spend some effort on the wrapping process, but you get 
something in return:

  * You can enrich the C prototypes with useful information like whether the 
pointer points to a single element or an array of elements.
  * You can end up with a (portable!) wrapper that is idiomatic Nim code that 
is useful for other people and can be uploaded and reviewed as ordinary Nim 
code, enhancing Nim's ecosystem of packages.



IMHO we should focus on **quality** wrappers. Python is not successful because 
the C interop is so "simple" that you can hack your way around with address-of 
operators (Python lacks such an operator). It's successful because the wrappers 
are solid, they always take care of memory management issues and provide a 
Pythonic API.

Reply via email to