haxscramper / hcparse

High-level nim bindings for parsing C/C++ code
https://haxscramper.github.io/hcparse-doc/src/hcparse/libclang.html
Apache License 2.0
37 stars 2 forks source link

Qt support #25

Open haxscramper opened 2 years ago

haxscramper commented 2 years ago

I don't think it makes sense to try and provide an overly generalized solution that might be further extended in order to work with Qt. Instead, support should be built-in, especially considering this is a non-trivial thing to do even in this mode.

Without accounting for some basic interop problems, like extreme difficulty of inheritance #2 , wrapping methods #1 and other things that are most likely yet to be discovered, there are some Qt-specific problems, that make it harder to provide meaningful wrappers. Specifically - signal and slot mechanism, dynamic properties. Latter one is not as fundamental as slots, so it can be addressed sometimes later. Slots on the other hand are the most important feature, and I really need to consider how to approach them.

Related

haxscramper commented 2 years ago

After reading https://woboq.com/blog/verdigris-qt-without-moc.html I think it would be possible to use https://github.com/woboq/verdigris approach, either directly or via additional codegen. I would need to generate c++ classes at some point anyway, so it makes sense to extend on that approach. Although, generated header files could be processed my mic as well, but it would require separate build step after every class has been generated. Is it possible run nim compiler in steps? Generate cxx code, and then compile things separately.