Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate completeStruct annotations when possible #7

Open
haxscramper opened this issue Sep 28, 2021 · 0 comments
Open

generate completeStruct annotations when possible #7

haxscramper opened this issue Sep 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@haxscramper
Copy link
Owner

haxscramper commented Sep 28, 2021

Allows to use sizeof on imporc types. Tricky as it requires to ensure that

  • there is no conditionally enabled branches, or their handling in nim is exactly matching (using 'when' conditions). Information about conditional field compilation must be provided in the IR as well, which requires specifying any preprocessor condition expression. Also libclang does not support preprocessor callbacks, so no this have to be accounter for as well. Boost::wave can handle conditional compilation registration with some additional work.
  • if wrapping an C++ object there must be no private fields, no parent classes, no virtual member functions (vtable pointer). This can also be partially emulated by inserting fake gensym elements for hidden data.
  • there is a way to test correctness of the generated object's sizeof. Clang can simply get this data via function call clang_Type_getSizeOf.
  • all field's types are either nim primitives, or also have sizeof declared
@haxscramper haxscramper added the enhancement New feature or request label Sep 28, 2021
@haxscramper haxscramper changed the title generate completeStruct annotstions when possible generate completeStruct annotations when possible Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant